diff --git a/README.md b/README.md
index 8cbe66105..7b835eae0 100644
--- a/README.md
+++ b/README.md
@@ -36,7 +36,7 @@ The following core Node.js modules (v8.7.0+) have been implemented:
| [net](https://nodejs.org/api/net.html) | |
| [os](https://nodejs.org/api/os.html) | :heavy_check_mark: |
| [path](https://nodejs.org/api/path.html) | :heavy_check_mark: |
-| [process](https://nodejs.org/api/process.html) | |
+| [process](https://nodejs.org/api/process.html) | :heavy_check_mark: |
| [querystring](https://nodejs.org/api/querystring.html) | :heavy_check_mark: |
| [readline](https://nodejs.org/api/readline.html) | |
| [repl](https://nodejs.org/api/repl.html) | |
diff --git a/app/current/src/main/scala/io/scalajs/nodejs/Global.scala b/app/current/src/main/scala/io/scalajs/nodejs/Global.scala
index 6aeb486e4..37f30530a 100644
--- a/app/current/src/main/scala/io/scalajs/nodejs/Global.scala
+++ b/app/current/src/main/scala/io/scalajs/nodejs/Global.scala
@@ -72,7 +72,7 @@ trait Global extends js.Object {
def console: console_module.Console = js.native
- def process: Process = js.native
+ def process: io.scalajs.nodejs.process.Process = js.native
def ref: Ref = js.native
diff --git a/app/current/src/main/scala/io/scalajs/nodejs/Process.scala b/app/current/src/main/scala/io/scalajs/nodejs/Process.scala
deleted file mode 100644
index f227e9d59..000000000
--- a/app/current/src/main/scala/io/scalajs/nodejs/Process.scala
+++ /dev/null
@@ -1,640 +0,0 @@
-package io.scalajs.nodejs
-
-import io.scalajs.nodejs.events.IEventEmitter
-import io.scalajs.nodejs.tty.{ReadStream, WriteStream}
-import io.scalajs.util.PromiseHelper._
-
-import scala.concurrent.Future
-import scala.scalajs.js
-import scala.scalajs.js.JSConverters._
-import scala.scalajs.js.UndefOr
-
-/**
- * The process object is a global object and can be accessed from anywhere. It is an instance of EventEmitter.
- */
-@js.native
-trait Process extends IEventEmitter {
-
- /////////////////////////////////////////////////////////////////////////////////
- // Properties
- /////////////////////////////////////////////////////////////////////////////////
-
- /**
- * What processor architecture you're running on: 'arm', 'ia32', or 'x64'.
- * @example process.arch
- */
- def arch: String = js.native
-
- /**
- * An array containing the command line arguments. The first element will be 'node', the second element will be
- * the name of the JavaScript file. The next elements will be any additional command line arguments.
- * @example process.argv
- */
- def argv: js.Array[String] = js.native
-
- /**
- * An Object containing the JavaScript representation of the configure options that were used to compile
- * the current Node.js executable.
- */
- def config: js.Dictionary[js.Any] = js.native
-
- /**
- * If process.connected is false, it is no longer possible to send messages
- * @example process.connected
- */
- def connected: js.UndefOr[Boolean] = js.native
-
- /**
- * Returns the debug port
- */
- def debugPort: Integer = js.native
-
- /**
- * An object containing the user environment.
- */
- def env: Environment = js.native
-
- /**
- * This is the set of Node.js-specific command line options from the executable that started the process.
- * These options do not show up in process.argv, and do not include the Node.js executable, the name of
- * the script, or any options following the script name. These options are useful in order to spawn
- * child processes with the same execution environment as the parent.
- * @since 0.7.7
- */
- def execArgv: js.Array[String] = js.native
-
- /**
- * This is the absolute pathname of the executable that started the process.
- * @example process.execPath
- */
- def execPath: String = js.native
-
- /**
- * A number which will be the process exit code, when the process either exits gracefully, or is exited
- * via process.exit() without specifying a code.
- *
- * Specifying a code to process.exit(code) will override any previous setting of process.exitCode.
- * @example process.exitCode
- */
- var exitCode: Int = js.native
-
- /**
- * TODO find documentation for this property
- */
- def features: js.Dictionary[Boolean] = js.native
-
- /**
- * Alternate way to retrieve require.main. The difference is that if the main module changes at runtime,
- * require.main might still refer to the original main module in modules that were required before the
- * change occurred. Generally it's safe to assume that the two refer to the same module.
- *
- * As with require.main, it will be undefined if there was no entry script.
- */
- def mainModule: js.UndefOr[js.Any] = js.native
-
- /**
- * Returns the loaded module list
- */
- def moduleLoadList: js.Array[String] = js.native
-
- /**
- * The PID of the process.
- * @example process.pid
- */
- def pid: Int = js.native
-
- /**
- * What platform you're running on: 'darwin', 'freebsd', 'linux', 'sunos' or 'win32'
- */
- def platform: String = js.native
-
- /**
- * An Object containing metadata related to the current release, including URLs for the source tarball
- * and headers-only tarball.
- * @since 3.0.0
- */
- def release: Process.ReleaseInfo = js.native
-
- /**
- * process.stderr and process.stdout are unlike other streams in Node.js in that they cannot be
- * closed (end() will throw), they never emit the finish event and that writes can block when output
- * is redirected to a file (although disks are fast and operating systems normally employ write-back
- * caching so it should be a very rare occurrence indeed.)
- */
- def stderr: WriteStream = js.native
-
- /**
- * A Readable Stream for stdin (on fd 0).
- */
- def stdin: ReadStream = js.native
-
- /**
- * process.stderr and process.stdout are unlike other streams in Node.js in that they cannot be
- * closed (end() will throw), they never emit the finish event and that writes can block when output
- * is redirected to a file (although disks are fast and operating systems normally employ write-back
- * caching so it should be a very rare occurrence indeed.)
- */
- def stdout: WriteStream = js.native
-
- /**
- * Getter/setter to set what is displayed in ps.
- * When used as a setter, the maximum length is platform-specific and probably short.
- * On Linux and OS X, it's limited to the size of the binary name plus the length of the command line
- * arguments because it overwrites the argv memory.
- * v0.8 allowed for longer process title strings by also overwriting the environ memory but that was
- * potentially insecure/confusing in some (rather obscure) cases.
- */
- var title: String = js.native
-
- /**
- * A compiled-in property that exposes NODE_VERSION.
- */
- def version: String = js.native
-
- /**
- * A property exposing version strings of Node.js and its dependencies.
- */
- def versions: Process.VersionInfo = js.native
-
- /////////////////////////////////////////////////////////////////////////////////
- // Methods
- /////////////////////////////////////////////////////////////////////////////////
-
- /**
- * This causes Node.js to emit an abort. This will cause Node.js to exit and generate a core file.
- * @example process.abort()
- */
- def abort(): Unit = js.native
-
- /**
- * Changes the current working directory of the process or throws an exception if that fails.
- * @example process.chdir(directory)
- */
- def chdir(directory: String): Unit = js.native
-
- /**
- * Returns the current working directory of the process.
- * @example process.cwd()
- */
- def cwd(): String = js.native
-
- /**
- * Close the IPC channel to the parent process, allowing this child to exit gracefully once there are no
- * other connections keeping it alive.
- *
- * Identical to the parent process's ChildProcess.disconnect().
- * If Node.js was not spawned with an IPC channel, process.disconnect() will be undefined.
- * @example process.disconnect()
- */
- def disconnect(): js.Any = js.native
-
- /**
- * The process.emitWarning() method can be used to emit custom or application specific process warnings.
- * These can be listened for by adding a handler to the process.on('warning') event.
- * @param warning The warning to emit (String | Error)
- * @param name When warning is a String, name is the name to use for the warning. Default: Warning.
- * @param ctor When warning is a String, ctor is an optional function used to limit the generated stack trace.
- * Default process.emitWarning
- * @example process.emitWarning(warning[, name][, ctor])
- */
- def emitWarning(warning: js.Any, name: String = null, ctor: js.Function = null): Unit = js.native
-
- /**
- * Ends the process with the specified code. If omitted, exit uses the 'success' code 0.
- * @example process.exit([code])
- */
- def exit(code: Int = 0): Unit = js.native
-
- /**
- * Gets the effective group identity of the process. This is the numerical group id, not the group name.
- *
Note: this function is only available on POSIX platforms (i.e. not Windows, Android)
- * @example process.getegid()
- */
- def getegid(): Int = js.native
-
- /**
- * Gets the effective user identity of the process. This is the numerical userid, not the username.
- * Note: this function is only available on POSIX platforms (i.e. not Windows, Android)
- * @example process.geteuid()
- */
- def geteuid(): Int = js.native
-
- /**
- * Gets the group identity of the process. This is the numerical group id, not the group name.
- * Note: this function is only available on POSIX platforms (i.e. not Windows, Android)
- * @example process.getgid()
- */
- def getgid(): Int = js.native
-
- /**
- * Returns an array with the supplementary group IDs. POSIX leaves it unspecified if the effective
- * group ID is included but Node.js ensures it always is.
- * @example process.getgroups()
- */
- def getgroups(): js.Array[Int] = js.native
-
- /**
- * Gets the user identity of the process. (See getuid(2).) This is the numerical userid, not the username.
- * Note: this function is only available on POSIX platforms (i.e. not Windows, Android)
- * @example process.getuid()
- */
- def getuid(): Int = js.native
-
- /**
- * Returns the current high-resolution real time in a [seconds, nanoseconds] tuple Array. It is relative to an
- * arbitrary time in the past. It is not related to the time of day and therefore not subject to clock drift.
- * The primary use is for measuring performance between intervals.
- * @example process.hrtime([time])
- */
- def hrtime(time: js.Array[Int] = js.native): js.Array[Int] = js.native
-
- /**
- * Reads /etc/group and initializes the group access list, using all groups of which the user is a member.
- * This is a privileged operation, meaning you need to be root or have the CAP_SETGID capability.
- * @example process.initgroups(user, extra_group)
- */
- def initgroups(user: String, extra_group: String): js.Array[Int] = js.native
-
- /**
- * Send a signal to a process. pid is the process id and signal is the string describing the signal to send.
- * Signal names are strings like SIGINT or SIGHUP. If omitted, the signal will be SIGTERM. See Signal Events
- * and kill(2) for more information.
- *
- * Will throw an error if target does not exist, and as a special case, a signal of 0 can be used to test for
- * the existence of a process. Windows platforms will throw an error if the pid is used to kill a process group.
- *
- * Note that even though the name of this function is process.kill, it is really just a signal sender,
- * like the kill system call. The signal sent may do something other than kill the target process.
- * @example process.kill(pid[, signal])
- */
- def kill(pid: Int, signal: String = null): Unit = js.native
-
- /**
- * Returns an object describing the memory usage of the Node.js process measured in bytes.
- * @example process.memoryUsage()
- */
- def memoryUsage(): Process.MemoryUsage = js.native
-
- /**
- * Once the current event loop turn runs to completion, call the callback function.
- *
- * This is not a simple alias to setTimeout(fn, 0), it's much more efficient. It runs before any
- * additional I/O events (including timers) fire in subsequent ticks of the event loop.
- * @example process.nextTick(callback[, arg][, ...])
- */
- def nextTick(callback: js.Function0[Any], args: js.Any*): Unit = js.native
-
- /**
- * TODO find documentation
- */
- def openStdin(): ReadStream = js.native
-
- /**
- * When Node.js is spawned with an IPC channel attached, it can send messages to its parent process
- * using process.send(). Each will be received as a 'message' event on the parent's ChildProcess object.
- *
- * Note: this function uses JSON.stringify() internally to serialize the message.
- * If Node.js was not spawned with an IPC channel, process.send() will be undefined.
- * @example {{{ process.send(message[, sendHandle[, options]][, callback]) }}}
- * @since 0.5.9
- */
- def send(message: js.Any, sendHandle: js.Any, options: Process.TransferOptions, callback: js.Function): Boolean =
- js.native
-
- /**
- * When Node.js is spawned with an IPC channel attached, it can send messages to its parent process
- * using process.send(). Each will be received as a 'message' event on the parent's ChildProcess object.
- *
- * Note: this function uses JSON.stringify() internally to serialize the message.
- * If Node.js was not spawned with an IPC channel, process.send() will be undefined.
- * @example {{{ process.send(message[, sendHandle[, options]][, callback]) }}}
- * @since 0.5.9
- */
- def send(message: js.Any, sendHandle: js.Any, options: Process.TransferOptions): Boolean = js.native
-
- /**
- * When Node.js is spawned with an IPC channel attached, it can send messages to its parent process
- * using process.send(). Each will be received as a 'message' event on the parent's ChildProcess object.
- *
- * Note: this function uses JSON.stringify() internally to serialize the message.
- * If Node.js was not spawned with an IPC channel, process.send() will be undefined.
- * @example {{{ process.send(message[, sendHandle[, options]][, callback]) }}}
- * @since 0.5.9
- */
- def send(message: js.Any, sendHandle: js.Any, callback: js.Function): Boolean = js.native
-
- /**
- * When Node.js is spawned with an IPC channel attached, it can send messages to its parent process
- * using process.send(). Each will be received as a 'message' event on the parent's ChildProcess object.
- *
- * Note: this function uses JSON.stringify() internally to serialize the message.
- * If Node.js was not spawned with an IPC channel, process.send() will be undefined.
- * @example {{{ process.send(message[, sendHandle[, options]][, callback]) }}}
- * @since 0.5.9
- */
- def send(message: js.Any, callback: js.Function): Boolean = js.native
-
- /**
- * When Node.js is spawned with an IPC channel attached, it can send messages to its parent process
- * using process.send(). Each will be received as a 'message' event on the parent's ChildProcess object.
- *
- * Note: this function uses JSON.stringify() internally to serialize the message.
- * If Node.js was not spawned with an IPC channel, process.send() will be undefined.
- * @example {{{ process.send(message[, sendHandle[, options]][, callback]) }}}
- * @since 0.5.9
- */
- def send(message: js.Any): Boolean = js.native
-
- /**
- * Sets the effective group identity of the process. This accepts either a numerical ID or a groupname string.
- * If a groupname is specified, this method blocks while resolving it to a numerical ID.
- * @example process.setegid(id)
- * @since 2.0.0
- */
- def setegid(id: Int): Unit = js.native
-
- /**
- * Sets the effective user identity of the process. This accepts either a numerical ID or a username string.
- * If a username is specified, this method blocks while resolving it to a numerical ID.
- * @example process.seteuid(id)
- */
- def seteuid(id: Int): Unit = js.native
-
- /**
- * Sets the group identity of the process. This accepts either a numerical ID or a groupname string.
- * If a groupname is specified, this method blocks while resolving it to a numerical ID.
- * @example process.setgid(id)
- */
- def setgid(id: Int): Unit = js.native
-
- /**
- * Sets the supplementary group IDs. This is a privileged operation, meaning you need to be root or have the
- * CAP_SETGID capability. The list can contain group IDs, group names or both.
- * @example process.setgroups(groups)
- */
- def setgroups[T](groups: js.Array[T]): Unit = js.native
-
- /**
- * Sets the user identity of the process. This accepts either a numerical ID or a username string.
- * If a username is specified, this method blocks while resolving it to a numerical ID.
- * @example process.setuid(id)
- */
- def setuid(id: Int): Unit = js.native
-
- /**
- * Sets or reads the process's file mode creation mask. Child processes inherit the mask from the parent process.
- * Returns the old mask if mask argument is given, otherwise returns the current mask.
- * @example process.umask([mask])
- */
- def umask(mask: Int): Int = js.native
-
- /**
- * Sets or reads the process's file mode creation mask. Child processes inherit the mask from the parent process.
- * Returns the old mask if mask argument is given, otherwise returns the current mask.
- * @example process.umask([mask])
- */
- def umask(): Int = js.native
-
- /**
- * Number of seconds Node.js has been running.
- * @example process.uptime()
- */
- def uptime(): Int = js.native
-
-}
-
-/**
- * Process Object Companion
- */
-object Process {
-
- /**
- * Process Environment Extensions
- * @param env the given environment dictionary
- */
- implicit class ProcessEnvExtensions(val env: js.Dictionary[String]) extends AnyVal {
-
- def HOME: UndefOr[String] = env.get("HOME").orUndefined
-
- def NODE_DEBUG: UndefOr[String] = env.get("NODE_DEBUG").orUndefined
-
- def NODE_ENV: UndefOr[String] = env.get("NODE_ENV").orUndefined
-
- def PATH: UndefOr[String] = env.get("PATH").orUndefined
-
- def SHELL: UndefOr[String] = env.get("SHELL").orUndefined
-
- def TERM: UndefOr[String] = env.get("TERM").orUndefined
-
- def TMPDIR: UndefOr[String] = env.get("TMPDIR").orUndefined
-
- def USER: UndefOr[String] = env.get("USER").orUndefined
-
- }
-
- /**
- * Process Object Extensions
- * @param process the given [[Process process]]
- */
- implicit class ProcessExtensions(val process: Process) extends AnyVal {
-
- /////////////////////////////////////////////////////////////////////////////////
- // Extensions
- /////////////////////////////////////////////////////////////////////////////////
-
- /**
- * @see [[Process.send()]]
- */
- @inline
- def sendFuture(message: js.Any, sendHandle: js.Any, options: Process.TransferOptions): Future[Boolean] = {
- promiseWithError1[Error, Boolean](process.send(message, sendHandle, options, _))
- }
-
- /**
- * @see [[Process.send()]]
- */
- @inline
- def sendFuture(message: js.Any, sendHandle: js.Any): Future[Boolean] = {
- promiseWithError1[Error, Boolean](process.send(message, sendHandle, _))
- }
-
- /**
- * @see [[Process.send()]]
- */
- @inline
- def sendFuture(message: js.Any): Future[Boolean] = {
- promiseWithError1[Error, Boolean](process.send(message, _))
- }
-
- /////////////////////////////////////////////////////////////////////////////////
- // Events
- /////////////////////////////////////////////////////////////////////////////////
-
- /**
- * This event is emitted when Node.js empties its event loop and has nothing else to schedule. Normally, Node.js
- * exits when there is no work scheduled, but a listener for 'beforeExit' can make asynchronous calls, and cause
- * Node.js to continue.
- *
- * 'beforeExit' is not emitted for conditions causing explicit termination, such as process.exit() or uncaught
- * exceptions, and should not be used as an alternative to the 'exit' event unless the intention is to schedule
- * more work.
- * @param listener the event listener function
- * @since 0.11.12
- */
- def onBeforeExit(listener: js.Function): process.type = process.on("beforeExit", listener)
-
- /**
- * If process is spawned with an IPC channel, 'disconnect' will be emitted when IPC channel is closed.
- * Read more in child_process 'disconnect' event doc.
- * @param listener the event listener function
- * @since 0.7.7
- */
- def onDisconnect(listener: js.Function): process.type = process.on("disconnect", listener)
-
- /**
- * Emitted when the process is about to exit. There is no way to prevent the exiting of the event loop at this point,
- * and once all 'exit' listeners have finished running the process will exit. Therefore you must only perform
- * synchronous operations in this handler. This is a good hook to perform checks on the module's state (like for
- * unit tests). The callback takes one argument, the code the process is exiting with.
- * @param listener the event listener function
- * @example process.on('exit', (code) => { ... })
- * @since 0.1.7
- */
- def onExit(listener: ExitCode => Any): process.type = process.on("exit", listener)
-
- /**
- * Messages sent by ChildProcess.send() are obtained using the 'message' event on the child's process object.
- * @param listener the event listener function
- *
- *
message:
- *
sendHandle: a net.Socket or net.Server object, or undefined.
- *
- * @since 0.5.10
- */
- def onMessage(listener: js.Function): process.type = process.on("message", listener)
-
- /**
- * Emitted whenever a Promise was rejected and an error handler was attached to it (for example with promise.catch())
- * later than after an event loop turn.
- * @param listener the event listener function
- */
- def onRejectionHandled(listener: js.Function): process.type = process.on("rejectionHandled", listener)
-
- /**
- * The 'uncaughtException' event is emitted when an exception bubbles all the way back to the event loop. By default,
- * Node.js handles such exceptions by printing the stack trace to stderr and exiting. Adding a handler for the
- * 'uncaughtException' event overrides this default behavior.
- * @param listener the event listener function
- */
- def onUncaughtException(listener: Error => Any): process.type = process.on("uncaughtException", listener)
-
- /**
- * Emitted whenever a Promise is rejected and no error handler is attached to the promise within a turn of the event
- * loop. When programming with promises exceptions are encapsulated as rejected promises. Such promises can be caught
- * and handled using promise.catch() and rejections are propagated through a promise chain. This event is useful for
- * detecting and keeping track of promises that were rejected whose rejections were not handled yet.
- * @param listener the event listener function
- */
- def onUnhandledRejection[T](listener: (String, js.Promise[T]) => Any): process.type =
- process.on("unhandledRejection", listener)
-
- /**
- * A process warning is similar to an error in that it describes exceptional conditions that are being brought to
- * the user's attention. However, warnings are not part of the normal Node.js and JavaScript error handling flow.
- * Node.js can emit warnings whenever it detects bad coding practices that could lead to sub-optimal application
- * performance, bugs or security vulnerabilities.
- *
- * The event handler for 'warning' events is called with a single warning argument whose value is an Error object.
- * @param listener the event listener function
- */
- def onWarning(listener: Warning => Any): process.type = process.on("warning", listener)
-
- /////////////////////////////////////////////////////////////////////////////////
- // Signal Events - Emitted when the processes receives a signal.
- // See sigaction(2) for a list of standard POSIX signal names
- // such as SIGINT, SIGHUP, etc.
- /////////////////////////////////////////////////////////////////////////////////
-
- /**
- * An easy way to send the SIGINT signal is with Control-C in most terminal programs.
- * @param listener the event listener function
- */
- def onSIGINT(listener: () => Any): process.type = process.on("SIGINT", listener)
-
- /**
- * SIGUSR1 is reserved by Node.js to start the debugger. It's possible to install a listener but that won't stop
- * the debugger from starting.
- * @param listener the event listener function
- */
- def onSIGUSR1(listener: () => Any): process.type = process.on("SIGUSR1", listener)
-
- }
-
- /**
- * Memory Usage
- */
- @js.native
- trait MemoryUsage extends js.Object {
- var rss: Double = js.native
- var heapTotal: Double = js.native
- var heapUsed: Double = js.native
- }
-
- /**
- * Release Information
- */
- @js.native
- trait ReleaseInfo extends js.Object {
- var name: String = js.native
- var sourceUrl: String = js.native
- var headersUrl: String = js.native
- var libUrl: String = js.native
- }
-
- /**
- * Transfer Options
- */
- @js.native
- trait TransferOptions extends js.Object {
- // TODO what are the transfer options?
- }
-
- /**
- * Version Information
- */
- @js.native
- trait VersionInfo extends js.Object {
- var http_parser: js.UndefOr[String] = js.native
- var node: js.UndefOr[String] = js.native
- var v8: js.UndefOr[String] = js.native
- var uv: js.UndefOr[String] = js.native
- var zlib: js.UndefOr[String] = js.native
- var ares: js.UndefOr[String] = js.native
- var modules: js.UndefOr[String] = js.native
- var icu: js.UndefOr[String] = js.native
- var openssl: js.UndefOr[String] = js.native
- }
-
- /**
- * Warning
- */
- @js.native
- trait Warning extends js.Object {
-
- /**
- * The name of the warning (currently Warning by default).
- */
- var name: String = js.native
-
- /**
- * A system-provided description of the warning.
- */
- var message: String = js.native
-
- /**
- * A stack trace to the location in the code where the warning was issued.
- */
- var stack: js.Any = js.native
- }
-
-}
diff --git a/app/current/src/main/scala/io/scalajs/nodejs/package.scala b/app/current/src/main/scala/io/scalajs/nodejs/package.scala
index 2c02d4c5b..a5cc1c53e 100644
--- a/app/current/src/main/scala/io/scalajs/nodejs/package.scala
+++ b/app/current/src/main/scala/io/scalajs/nodejs/package.scala
@@ -18,7 +18,11 @@ package object nodejs {
// Type Definitions
/////////////////////////////////////////////////////////////////////////////////
- type Environment = js.Dictionary[String]
+ @deprecated("use process.Process instead", "0.9.0")
+ type Process = process.Process
+
+ @deprecated("use process.Environment instead", "0.9.0")
+ type Environment = process.Environment
type EventType = String
@@ -87,13 +91,6 @@ package object nodejs {
@JSGlobal("global")
object global extends Global
- /**
- * The process object. See the process object section.
- */
- @js.native
- @JSGlobal("process")
- object process extends Process
-
/////////////////////////////////////////////////////////////////////////////////
// Timers
/////////////////////////////////////////////////////////////////////////////////
diff --git a/app/current/src/main/scala/io/scalajs/nodejs/process/Process.scala b/app/current/src/main/scala/io/scalajs/nodejs/process/Process.scala
new file mode 100644
index 000000000..f4c40a6ef
--- /dev/null
+++ b/app/current/src/main/scala/io/scalajs/nodejs/process/Process.scala
@@ -0,0 +1,518 @@
+package io.scalajs.nodejs.process
+
+import com.thoughtworks.{enableIf, enableMembersIf}
+import io.scalajs.nodejs.events.IEventEmitter
+import io.scalajs.nodejs.tty.{ReadStream, WriteStream}
+
+import scala.scalajs.js
+import scala.scalajs.js.annotation.JSGlobal
+import scala.scalajs.js.|
+
+/**
+ * The process object is a global object and can be accessed from anywhere. It is an instance of EventEmitter.
+ */
+@js.native
+trait Process extends IEventEmitter {
+
+ /////////////////////////////////////////////////////////////////////////////////
+ // Properties
+ /////////////////////////////////////////////////////////////////////////////////
+
+ def allowedNodeEnvironmentFlags: EnvironmentFlags = js.native
+
+ /**
+ * What processor architecture you're running on: 'arm', 'ia32', or 'x64'.
+ * @example process.arch
+ */
+ def arch: String = js.native
+
+ /**
+ * An array containing the command line arguments. The first element will be 'node', the second element will be
+ * the name of the JavaScript file. The next elements will be any additional command line arguments.
+ * @example process.argv
+ */
+ def argv: js.Array[String] = js.native
+
+ def argv0: String = js.native
+
+ def channel: js.UndefOr[js.Object] = js.native
+
+ /**
+ * An Object containing the JavaScript representation of the configure options that were used to compile
+ * the current Node.js executable.
+ */
+ def config: ProcessConfig = js.native
+
+ /**
+ * If process.connected is false, it is no longer possible to send messages
+ * @example process.connected
+ */
+ def connected: js.UndefOr[Boolean] = js.native
+
+ /**
+ * Returns the debug port
+ */
+ def debugPort: Integer = js.native
+
+ /**
+ * An object containing the user environment.
+ */
+ def env: Environment = js.native
+
+ /**
+ * This is the set of Node.js-specific command line options from the executable that started the process.
+ * These options do not show up in process.argv, and do not include the Node.js executable, the name of
+ * the script, or any options following the script name. These options are useful in order to spawn
+ * child processes with the same execution environment as the parent.
+ * @since 0.7.7
+ */
+ def execArgv: js.Array[String] = js.native
+
+ /**
+ * This is the absolute pathname of the executable that started the process.
+ * @example process.execPath
+ */
+ def execPath: String = js.native
+
+ /**
+ * A number which will be the process exit code, when the process either exits gracefully, or is exited
+ * via process.exit() without specifying a code.
+ *
+ * Specifying a code to process.exit(code) will override any previous setting of process.exitCode.
+ * @example process.exitCode
+ */
+ def exitCode: Int = js.native
+
+ /**
+ * TODO find documentation for this property
+ */
+ def features: js.Dictionary[Boolean] = js.native
+
+ /**
+ * Alternate way to retrieve require.main. The difference is that if the main module changes at runtime,
+ * require.main might still refer to the original main module in modules that were required before the
+ * change occurred. Generally it's safe to assume that the two refer to the same module.
+ *
+ * As with require.main, it will be undefined if there was no entry script.
+ */
+ def mainModule: js.UndefOr[js.Any] = js.native
+
+ /**
+ * Returns the loaded module list
+ */
+ def moduleLoadList: js.Array[String] = js.native
+
+ def noDeprecation: js.UndefOr[Boolean] = js.native
+
+ /**
+ * The PID of the process.
+ * @example process.pid
+ */
+ def pid: Int = js.native
+
+ def ppid: Int = js.native
+
+ /**
+ * What platform you're running on: 'darwin', 'freebsd', 'linux', 'sunos' or 'win32'
+ */
+ def platform: String = js.native
+
+ /**
+ * An Object containing metadata related to the current release, including URLs for the source tarball
+ * and headers-only tarball.
+ * @since 3.0.0
+ */
+ def release: ReleaseInfo = js.native
+
+ @enableIf(io.scalajs.nodejs.CompilerSwitches.gteNodeJs12)
+ def report: js.UndefOr[Reporter] = js.native
+
+ @enableIf(io.scalajs.nodejs.CompilerSwitches.gteNodeJs12)
+ def resourceUsage(): ResourceUsage = js.native
+
+ /**
+ * process.stderr and process.stdout are unlike other streams in Node.js in that they cannot be
+ * closed (end() will throw), they never emit the finish event and that writes can block when output
+ * is redirected to a file (although disks are fast and operating systems normally employ write-back
+ * caching so it should be a very rare occurrence indeed.)
+ */
+ def stderr: WriteStream = js.native
+
+ /**
+ * A Readable Stream for stdin (on fd 0).
+ */
+ def stdin: ReadStream = js.native
+
+ /**
+ * process.stderr and process.stdout are unlike other streams in Node.js in that they cannot be
+ * closed (end() will throw), they never emit the finish event and that writes can block when output
+ * is redirected to a file (although disks are fast and operating systems normally employ write-back
+ * caching so it should be a very rare occurrence indeed.)
+ */
+ def stdout: WriteStream = js.native
+
+ /**
+ * Getter/setter to set what is displayed in ps.
+ * When used as a setter, the maximum length is platform-specific and probably short.
+ * On Linux and OS X, it's limited to the size of the binary name plus the length of the command line
+ * arguments because it overwrites the argv memory.
+ * v0.8 allowed for longer process title strings by also overwriting the environ memory but that was
+ * potentially insecure/confusing in some (rather obscure) cases.
+ */
+ var title: String = js.native
+
+ def throwDeprecation: js.UndefOr[Boolean] = js.native
+
+ def traceDeprecation: js.UndefOr[Boolean] = js.native
+
+ /**
+ * A compiled-in property that exposes NODE_VERSION.
+ */
+ def version: String = js.native
+
+ /**
+ * A property exposing version strings of Node.js and its dependencies.
+ */
+ def versions: ComponentVersion = js.native
+
+ /////////////////////////////////////////////////////////////////////////////////
+ // Methods
+ /////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * This causes Node.js to emit an abort. This will cause Node.js to exit and generate a core file.
+ * @example process.abort()
+ */
+ def abort(): Unit = js.native
+
+ /**
+ * Changes the current working directory of the process or throws an exception if that fails.
+ * @example process.chdir(directory)
+ */
+ def chdir(directory: String): Unit = js.native
+
+ def cpuUsage(previousValue: CpuUsage = js.native): CpuUsage = js.native
+
+ /**
+ * Returns the current working directory of the process.
+ * @example process.cwd()
+ */
+ def cwd(): String = js.native
+
+ /**
+ * Close the IPC channel to the parent process, allowing this child to exit gracefully once there are no
+ * other connections keeping it alive.
+ *
+ * Identical to the parent process's ChildProcess.disconnect().
+ * If Node.js was not spawned with an IPC channel, process.disconnect() will be undefined.
+ * @example process.disconnect()
+ */
+ def disconnect(): js.Any = js.native
+
+ def dlopen(module: io.scalajs.nodejs.Module, filename: String, flags: Int = js.native): Unit = js.native
+
+ def emitWarning(warning: io.scalajs.nodejs.Error): Unit = js.native
+ def emitWarning(warning: String,
+ `type`: String = js.native,
+ code: String = js.native,
+ ctor: js.Function = js.native): Unit = js.native
+ def emitWarning(warning: String, options: WarningOptions): Unit = js.native
+
+ /**
+ * Ends the process with the specified code. If omitted, exit uses the 'success' code 0.
+ * @example process.exit([code])
+ */
+ def exit(code: Int = js.native): Unit = js.native
+
+ /**
+ * Gets the effective group identity of the process. This is the numerical group id, not the group name.
+ * Note: this function is only available on POSIX platforms (i.e. not Windows, Android)
+ * @example process.getegid()
+ */
+ def getegid(): Int = js.native
+
+ /**
+ * Gets the effective user identity of the process. This is the numerical userid, not the username.
+ * Note: this function is only available on POSIX platforms (i.e. not Windows, Android)
+ * @example process.geteuid()
+ */
+ def geteuid(): Int = js.native
+
+ /**
+ * Gets the group identity of the process. This is the numerical group id, not the group name.
+ * Note: this function is only available on POSIX platforms (i.e. not Windows, Android)
+ * @example process.getgid()
+ */
+ def getgid(): Int = js.native
+
+ /**
+ * Returns an array with the supplementary group IDs. POSIX leaves it unspecified if the effective
+ * group ID is included but Node.js ensures it always is.
+ * @example process.getgroups()
+ */
+ def getgroups(): js.Array[Int] = js.native
+
+ /**
+ * Gets the user identity of the process. (See getuid(2).) This is the numerical userid, not the username.
+ * Note: this function is only available on POSIX platforms (i.e. not Windows, Android)
+ * @example process.getuid()
+ */
+ def getuid(): Int = js.native
+
+ /**
+ * Returns the current high-resolution real time in a [seconds, nanoseconds] tuple Array. It is relative to an
+ * arbitrary time in the past. It is not related to the time of day and therefore not subject to clock drift.
+ * The primary use is for measuring performance between intervals.
+ * @example process.hrtime([time])
+ */
+ val hrtime: HrTime = js.native
+
+ /**
+ * Reads /etc/group and initializes the group access list, using all groups of which the user is a member.
+ * This is a privileged operation, meaning you need to be root or have the CAP_SETGID capability.
+ * @example process.initgroups(user, extra_group)
+ */
+ def initgroups(user: String | Int, extra_group: String | Int): js.Array[Int] = js.native
+
+ @enableIf(io.scalajs.nodejs.CompilerSwitches.gteNodeJs10)
+ def hasUncaughtExceptionCaptureCallback(): Boolean = js.native
+
+ /**
+ * Send a signal to a process. pid is the process id and signal is the string describing the signal to send.
+ * Signal names are strings like SIGINT or SIGHUP. If omitted, the signal will be SIGTERM. See Signal Events
+ * and kill(2) for more information.
+ *
+ * Will throw an error if target does not exist, and as a special case, a signal of 0 can be used to test for
+ * the existence of a process. Windows platforms will throw an error if the pid is used to kill a process group.
+ *
+ * Note that even though the name of this function is process.kill, it is really just a signal sender,
+ * like the kill system call. The signal sent may do something other than kill the target process.
+ * @example process.kill(pid[, signal])
+ */
+ def kill(pid: Int, signal: String | Int = js.native): Unit = js.native
+
+ /**
+ * Returns an object describing the memory usage of the Node.js process measured in bytes.
+ * @example process.memoryUsage()
+ */
+ def memoryUsage(): MemoryUsage = js.native
+
+ /**
+ * Once the current event loop turn runs to completion, call the callback function.
+ *
+ * This is not a simple alias to setTimeout(fn, 0), it's much more efficient. It runs before any
+ * additional I/O events (including timers) fire in subsequent ticks of the event loop.
+ * @example process.nextTick(callback[, arg][, ...])
+ */
+ def nextTick(callback: js.Function0[Any], args: js.Any*): Unit = js.native
+
+ /**
+ * TODO find documentation
+ */
+ def openStdin(): ReadStream = js.native
+
+ /**
+ * When Node.js is spawned with an IPC channel attached, it can send messages to its parent process
+ * using process.send(). Each will be received as a 'message' event on the parent's ChildProcess object.
+ *
+ * Note: this function uses JSON.stringify() internally to serialize the message.
+ * If Node.js was not spawned with an IPC channel, process.send() will be undefined.
+ * @example {{{ process.send(message[, sendHandle[, options]][, callback]) }}}
+ * @since 0.5.9
+ */
+ def send(message: js.Any,
+ sendHandle: SendHandle,
+ options: TransferOptions,
+ callback: js.Function = js.native): Boolean = js.native
+ def send(message: js.Any, sendHandle: SendHandle, options: TransferOptions): Boolean = js.native
+ def send(message: js.Any, sendHandle: SendHandle, callback: js.Function): Boolean = js.native
+ def send(message: js.Any, sendHandle: SendHandle): Boolean = js.native
+ def send(message: js.Any, callback: js.Function): Boolean = js.native
+ def send(message: js.Any): Boolean = js.native
+
+ /**
+ * Sets the effective group identity of the process. This accepts either a numerical ID or a groupname string.
+ * If a groupname is specified, this method blocks while resolving it to a numerical ID.
+ * @example process.setegid(id)
+ * @since 2.0.0
+ */
+ def setegid(id: String | Int): Unit = js.native
+
+ /**
+ * Sets the effective user identity of the process. This accepts either a numerical ID or a username string.
+ * If a username is specified, this method blocks while resolving it to a numerical ID.
+ * @example process.seteuid(id)
+ */
+ def seteuid(id: String | Int): Unit = js.native
+
+ /**
+ * Sets the group identity of the process. This accepts either a numerical ID or a groupname string.
+ * If a groupname is specified, this method blocks while resolving it to a numerical ID.
+ * @example process.setgid(id)
+ */
+ def setgid(id: String | Int): Unit = js.native
+
+ /**
+ * Sets the supplementary group IDs. This is a privileged operation, meaning you need to be root or have the
+ * CAP_SETGID capability. The list can contain group IDs, group names or both.
+ * @example process.setgroups(groups)
+ */
+ def setgroups(groups: js.Array[Int] | js.Array[String] | js.Array[String | Int]): Unit = js.native
+
+ /**
+ * Sets the user identity of the process. This accepts either a numerical ID or a username string.
+ * If a username is specified, this method blocks while resolving it to a numerical ID.
+ * @example process.setuid(id)
+ */
+ def setuid(id: String | Int): Unit = js.native
+
+ @enableIf(io.scalajs.nodejs.CompilerSwitches.gteNodeJs10)
+ def setUncaughtExceptionCaptureCallback(callback: js.Function = js.native): Unit = js.native
+
+ /**
+ * Sets or reads the process's file mode creation mask. Child processes inherit the mask from the parent process.
+ * Returns the old mask if mask argument is given, otherwise returns the current mask.
+ * @example process.umask([mask])
+ */
+ def umask(mask: Int): Int = js.native
+
+ /**
+ * Sets or reads the process's file mode creation mask. Child processes inherit the mask from the parent process.
+ * Returns the old mask if mask argument is given, otherwise returns the current mask.
+ * @example process.umask([mask])
+ */
+ def umask(): Int = js.native
+
+ /**
+ * Number of seconds Node.js has been running.
+ * @example process.uptime()
+ */
+ def uptime(): Int = js.native
+
+}
+
+@js.native
+@JSGlobal("process")
+object Process extends Process
+
+/**
+ * Memory Usage
+ */
+@js.native
+trait MemoryUsage extends js.Object {
+ var rss: Int = js.native
+ var heapTotal: Int = js.native
+ var heapUsed: Int = js.native
+ var external: Int = js.native
+}
+
+@js.native
+trait ReleaseInfo extends js.Object {
+ var name: String = js.native
+ var sourceUrl: String = js.native
+ var headersUrl: String = js.native
+ var libUrl: js.UndefOr[String] = js.native
+ var lts: js.UndefOr[String] = js.native
+}
+
+/**
+ * Transfer Options
+ */
+@js.native
+trait TransferOptions extends js.Object {
+ // TODO what are the transfer options?
+}
+
+/**
+ * Version Information
+ */
+@js.native
+trait ComponentVersion extends js.Object {
+ var node: String = js.native
+ var uv: String = js.native
+ var zlib: String = js.native
+ var ares: String = js.native
+ var modules: String = js.native
+ var http_parser: String = js.native
+ var openssl: String = js.native
+ var icu: String = js.native
+ var unicode: String = js.native
+
+ @enableIf(io.scalajs.nodejs.CompilerSwitches.gteNodeJs10)
+ var v8: String = js.native
+ @enableIf(io.scalajs.nodejs.CompilerSwitches.gteNodeJs10)
+ var brotli: String = js.native
+ @enableIf(io.scalajs.nodejs.CompilerSwitches.gteNodeJs10)
+ var nghttp2: String = js.native
+ @enableIf(io.scalajs.nodejs.CompilerSwitches.gteNodeJs10)
+ var napi: String = js.native
+ @enableIf(io.scalajs.nodejs.CompilerSwitches.gteNodeJs10)
+ var llhttp: String = js.native
+ @enableIf(io.scalajs.nodejs.CompilerSwitches.gteNodeJs10)
+ var cldr: String = js.native
+ @enableIf(io.scalajs.nodejs.CompilerSwitches.gteNodeJs10)
+ var tz: String = js.native
+}
+
+/**
+ * Warning
+ */
+@js.native
+trait Warning extends js.Object {
+
+ /**
+ * The name of the warning (currently Warning by default).
+ */
+ var name: String = js.native
+
+ /**
+ * A system-provided description of the warning.
+ */
+ var message: String = js.native
+
+ /**
+ * A stack trace to the location in the code where the warning was issued.
+ */
+ var stack: js.Any = js.native
+}
+
+@js.native
+trait CpuUsage extends js.Object {
+ val user: Int = js.native
+ val system: Int = js.native
+}
+
+class WarningOptions(
+ val `type`: js.UndefOr[String] = js.undefined,
+ val code: js.UndefOr[String] = js.undefined,
+ val detail: js.UndefOr[String] = js.undefined,
+ val ctor: js.UndefOr[js.Function] = js.undefined
+) extends js.Object {}
+
+@js.native
+trait HrTime extends js.Function1[js.Array[Int], js.Array[Int]] with js.Function0[js.Array[Int]] {
+ // TODO: js.BigInt
+ @enableIf(io.scalajs.nodejs.CompilerSwitches.gteNodeJs10)
+ def bigint(): js.Any = js.native
+}
+
+@enableMembersIf(io.scalajs.nodejs.CompilerSwitches.gteNodeJs12)
+@js.native
+trait ResourceUsage extends js.Object {
+ var userCPUTime: Int = js.native
+ var systemCPUTime: Int = js.native
+ var maxRSS: Int = js.native
+ var sharedMemorySize: Int = js.native
+ var unsharedDataSize: Int = js.native
+ var unsharedStackSize: Int = js.native
+ var minorPageFault: Int = js.native
+ var majorPageFault: Int = js.native
+ var swappedOut: Int = js.native
+ var fsRead: Int = js.native
+ var fsWrite: Int = js.native
+ var ipcSent: Int = js.native
+ var ipcReceived: Int = js.native
+ var signalsCount: Int = js.native
+ var voluntaryContextSwitches: Int = js.native
+ var involuntaryContextSwitches: Int = js.native
+}
diff --git a/app/current/src/main/scala/io/scalajs/nodejs/process/ProcessConfig.scala b/app/current/src/main/scala/io/scalajs/nodejs/process/ProcessConfig.scala
new file mode 100644
index 000000000..e2674da9f
--- /dev/null
+++ b/app/current/src/main/scala/io/scalajs/nodejs/process/ProcessConfig.scala
@@ -0,0 +1,87 @@
+package io.scalajs.nodejs.process
+
+import scala.scalajs.js
+
+@js.native
+trait ProcessConfig extends js.Object {
+ var target_defaults: ProcessConfigTargetDefaults = js.native
+ var variables: ProcessConfigVariable = js.native
+}
+
+@js.native
+trait ProcessConfigTargetDefaults extends js.Object {
+ var cflags: js.Array[js.Any] = js.native
+ var deafult_configuration: String = js.native
+ var defines: js.Array[js.Any] = js.native
+ var include_dirs: js.Array[js.Any] = js.native
+ var libraries: js.Array[js.Any] = js.native
+}
+
+@js.native
+trait ProcessConfigVariable extends js.Object {
+ var asan: Int = js.native
+ var build_v8_with_gn: Boolean = js.native
+ var coverage: Boolean = js.native
+ var debug_nghttp2: Boolean = js.native
+ var enable_lto: Boolean = js.native
+ var enable_pgo_generate: Boolean = js.native
+ var enable_pgo_use: Boolean = js.native
+ var force_dynamic_crt: Int = js.native
+ var gas_version: String = js.native
+ var host_arch: String = js.native
+ var icu_data_in: String = js.native
+ var icu_endianness: String = js.native
+ var icu_gyp_path: String = js.native
+ var icu_locales: String = js.native
+ var icu_path: String = js.native
+ var icu_small: Boolean = js.native
+ var icu_ver_major: String = js.native
+ var is_debug: Int = js.native
+ var llvm_version: Int = js.native
+ var napi_build_version: String = js.native
+ var node_byteorder: String = js.native
+ var node_code_cache: String = js.native
+ var node_debug_lib: Boolean = js.native
+ var node_enable_d8: Boolean = js.native
+ var node_install_npm: Boolean = js.native
+ var node_module_version: Int = js.native
+ var node_no_browser_globals: Boolean = js.native
+ var node_prefix: String = js.native
+ var node_release_urlbase: String = js.native
+ var node_report: Boolean = js.native
+ var node_shared: Boolean = js.native
+ var node_shared_cares: Boolean = js.native
+ var node_shared_http_parser: Boolean = js.native
+ var node_shared_libuv: Boolean = js.native
+ var node_shared_nghttp2: Boolean = js.native
+ var node_shared_openssl: Boolean = js.native
+ var node_shared_zlib: String = js.native
+ var node_tag: String = js.native
+ var node_target_type: String = js.native
+ var node_use_bundled_v8: Boolean = js.native
+ var node_use_dtrace: Boolean = js.native
+ var node_use_etw: Boolean = js.native
+ var node_use_large_pages: Boolean = js.native
+ var node_use_large_pages_script_lld: Boolean = js.native
+ var node_use_node_snapshot: Boolean = js.native
+ var node_use_openssl: Boolean = js.native
+ var node_use_v8_platform: Boolean = js.native
+ var node_with_ltcg: Boolean = js.native
+ var node_without_node_options: Boolean = js.native
+ var openssl_fips: String = js.native
+ var openssl_is_fips: Boolean = js.native
+ var shlib_suffix: String = js.native
+ var target_arch: String = js.native
+ var v8_enable_gdbjit: Int = js.native
+ var v8_enable_i18n_support: Int = js.native
+ var v8_enable_inspector: Int = js.native
+ var v8_no_strict_aliasing: Int = js.native
+ var v8_optimized_debug: Int = js.native
+ var v8_promise_internal_field_count: Int = js.native
+ var v8_random_seed: Int = js.native
+ var v8_trace_maps: Int = js.native
+ var v8_use_siphash: Int = js.native
+ var v8_use_snapshot: Int = js.native
+ var want_separate_host_toolset: Int = js.native
+
+}
diff --git a/app/current/src/main/scala/io/scalajs/nodejs/process/Reporter.scala b/app/current/src/main/scala/io/scalajs/nodejs/process/Reporter.scala
new file mode 100644
index 000000000..43ae66f67
--- /dev/null
+++ b/app/current/src/main/scala/io/scalajs/nodejs/process/Reporter.scala
@@ -0,0 +1,192 @@
+package io.scalajs.nodejs.process
+
+import com.thoughtworks.enableMembersIf
+
+import scala.scalajs.js
+import scala.scalajs.js.|
+
+@enableMembersIf(io.scalajs.nodejs.CompilerSwitches.gteNodeJs12)
+@js.native
+trait Reporter extends js.Object {
+ def getReport(err: io.scalajs.nodejs.Error = js.native): Reporter = js.native
+
+ def directory: String = js.native
+ def directory_=(v: String): Unit = js.native
+
+ def filename: String = js.native
+ def filename_=(v: String): Unit = js.native
+
+ def signal: String = js.native
+ def signal_=(v: String): Unit = js.native
+
+ def reportOnFatalError: Boolean = js.native
+ def reportOnFatalError_=(v: Boolean): Unit = js.native
+
+ def reportOnSignal: Boolean = js.native
+ def reportOnSignal_=(v: Boolean): Unit = js.native
+
+ def reportOnUncaughtException: Boolean = js.native
+ def reportOnUncaughtException_=(v: Boolean): Unit = js.native
+}
+
+@js.native
+trait Report extends js.Object {
+ var header: js.Object = js.native
+ var javascriptStack: JavascriptStack = js.native
+ var nativeStack: js.Array[NativeStackInfo] = js.native
+ var javascriptHeap: JavascriptHeap = js.native
+ var resourceUsage: ReportResourceUsage = js.native
+ var uvthreadResourceUsage: UvThreadResourceUsage = js.native
+ var libuv: js.Array[Libuv] = js.native
+ var environmentVariables: js.Dictionary[String] = js.native
+ var userLimits: js.Dictionary[UserLimit] = js.native
+ val sharedObjects: js.Array[String] = js.native
+}
+
+@js.native
+trait Header extends js.Object {
+ var arch: String = js.native
+ var commandLine: js.Array[String] = js.native
+ var componentVersions: ComponentVersion = js.native
+ var cpus: js.Array[Cpu] = js.native
+ var cwd: String = js.native
+ var dumpEventTime: String = js.native
+ var event: String = js.native
+ var filename: String | Null = js.native
+ var glibcVersionCompiler: String = js.native
+ var glibcVersionRuntime: String = js.native
+ var host: String = js.native
+ var networkInterfaces: js.Array[NetworkInterface] = js.native
+ var nodejsVersion: String = js.native
+ var osMachine: String = js.native
+ var osName: String = js.native
+ var osRelease: String = js.native
+ var osVersion: String = js.native
+ var platorm: String = js.native
+ var processId: Int = js.native
+ var release: ReleaseInfo = js.native
+ var reportVersion: Int = js.native
+ var trigger: String = js.native
+ var wordSize: Int = js.native
+}
+@js.native
+trait Cpu extends js.Object {
+ var model: String = js.native
+ var speed: Int = js.native
+ var user: Int = js.native
+ var nice: Int = js.native
+ var sys: Int = js.native
+ var idle: Int = js.native
+ var irq: Int = js.native
+}
+
+@js.native
+trait NetworkInterface extends js.Object {
+ var name: String = js.native
+ var internal: Boolean = js.native
+ var mac: String = js.native
+ var address: String = js.native
+ var netmask: String = js.native
+ var family: String = js.native
+ var scopeId: js.UndefOr[Int] = js.native
+}
+
+@js.native
+trait JavascriptStack extends js.Object {
+ var message: String = js.native
+ var stack: js.Array[String] = js.native
+}
+
+@js.native
+trait NativeStackInfo extends js.Object {
+ var pc: String = js.native
+ var symbol: String = js.native
+}
+
+@js.native
+trait JavascriptHeap extends js.Object {
+ var totalMemory: Int = js.native
+ var totalCommittedMemory: Int = js.native
+ var usedMemory: Int = js.native
+ var availableMemory: Int = js.native
+ var memoryLimit: Int = js.native
+ var heapSpaces: HeapSpaces = js.native
+}
+
+@js.native
+trait HeapSpaces extends js.Object {
+ var read_only_space: JsHeapSpace = js.native
+ var new_space: JsHeapSpace = js.native
+ var old_space: JsHeapSpace = js.native
+ var code_space: JsHeapSpace = js.native
+ var map_space: JsHeapSpace = js.native
+ var large_object_space: JsHeapSpace = js.native
+ var code_large_object_space: JsHeapSpace = js.native
+ var new_large_object_space: JsHeapSpace = js.native
+}
+
+@js.native
+trait JsHeapSpace extends js.Object {
+ var memorySize: Int = js.native
+ var committedMemory: Int = js.native
+ var capacity: Int = js.native
+ var used: Int = js.native
+ var available: Int = js.native
+}
+
+@js.native
+trait ReportResourceUsage extends js.Object {
+ var userCpuSeconds: Double = js.native
+ var kernelCpuSeconds: Double = js.native
+ var cpuConsumptionPercent: Double = js.native
+ var maxRss: Int = js.native
+ var pageFaults: PageFaults = js.native
+ var fsActivity: FsActivity = js.native
+}
+
+@js.native
+trait PageFaults extends js.Object {
+ var IORequired: Int = js.native
+ var IONotRequired: Int = js.native
+}
+
+@js.native
+trait UvThreadResourceUsage extends js.Object {
+ var userCpuSeconds: Double = js.native
+ var kernelCpuSeconds: Double = js.native
+ var cpuConsumptionPercent: Double = js.native
+ var fsActivity: FsActivity = js.native
+}
+
+@js.native
+trait FsActivity extends js.Object {
+ var reads: Int = js.native
+ var writes: Int = js.native
+}
+
+@js.native
+trait Libuv extends js.Object {
+ var `type`: String = js.native
+ var is_active: Boolean = js.native
+ var address: String = js.native
+
+ var is_referenced: js.UndefOr[Boolean] = js.native
+ var details: js.UndefOr[String] = js.native
+ var repeat: js.UndefOr[Int] = js.native
+ var firesInMsFromNow: js.UndefOr[Int] = js.native
+ var expired: js.UndefOr[Boolean] = js.native
+ var width: js.UndefOr[Int] = js.native
+ var height: js.UndefOr[Int] = js.native
+ var fd: js.UndefOr[Int] = js.native
+ var writeQueueSize: js.UndefOr[Int] = js.native
+ var readable: js.UndefOr[Boolean] = js.native
+ var writable: js.UndefOr[Boolean] = js.native
+ var signum: js.UndefOr[Int] = js.native
+ var signal: js.UndefOr[String] = js.native
+}
+
+@js.native
+trait UserLimit extends js.Object {
+ var soft: Int | String
+ var hard: Int | String
+}
diff --git a/app/current/src/main/scala/io/scalajs/nodejs/process/package.scala b/app/current/src/main/scala/io/scalajs/nodejs/process/package.scala
new file mode 100644
index 000000000..cf7df6ec2
--- /dev/null
+++ b/app/current/src/main/scala/io/scalajs/nodejs/process/package.scala
@@ -0,0 +1,364 @@
+package io.scalajs.nodejs
+
+import com.thoughtworks.enableIf
+import io.scalajs.nodejs.tty.{ReadStream, WriteStream}
+import io.scalajs.util.PromiseHelper.promiseWithError1
+
+import scala.concurrent.Future
+import scala.scalajs.js
+import scala.scalajs.js.|
+import scala.scalajs.js.JSConverters._
+
+package object process {
+ type Environment = js.Dictionary[String]
+ // TODO: js.Set
+ type EnvironmentFlags = js.Any
+
+ type SendHandle = net.Socket | net.Server
+
+ @deprecated("use Process object instead", "0.9.0")
+ def allowedNodeEnvironmentFlags: EnvironmentFlags = Process.allowedNodeEnvironmentFlags
+ @deprecated("use Process object instead", "0.9.0")
+ def arch: String = Process.arch
+ @deprecated("use Process object instead", "0.9.0")
+ def argv: js.Array[String] = Process.argv
+ @deprecated("use Process object instead", "0.9.0")
+ def argv0: String = Process.argv0
+ @deprecated("use Process object instead", "0.9.0")
+ def channel: js.UndefOr[js.Object] = Process.channel
+ @deprecated("use Process object instead", "0.9.0")
+ def config: ProcessConfig = Process.config
+ @deprecated("use Process object instead", "0.9.0")
+ def connected: js.UndefOr[Boolean] = Process.connected
+ @deprecated("use Process object instead", "0.9.0")
+ def debugPort: Integer = Process.debugPort
+ @deprecated("use Process object instead", "0.9.0")
+ def env: Environment = Process.env
+ @deprecated("use Process object instead", "0.9.0")
+ def execArgv: js.Array[String] = Process.execArgv
+ @deprecated("use Process object instead", "0.9.0")
+ def execPath: String = Process.execPath
+ @deprecated("use Process object instead", "0.9.0")
+ def exitCode: Int = Process.exitCode
+ @deprecated("use Process object instead", "0.9.0")
+ def features: js.Dictionary[Boolean] = Process.features
+ @deprecated("use Process object instead", "0.9.0")
+ def mainModule: js.UndefOr[js.Any] = Process.mainModule
+ @deprecated("use Process object instead", "0.9.0")
+ def moduleLoadList: js.Array[String] = Process.moduleLoadList
+ @deprecated("use Process object instead", "0.9.0")
+ def pid: Int = Process.pid
+ @deprecated("use Process object instead", "0.9.0")
+ def platform: String = Process.platform
+ @deprecated("use Process object instead", "0.9.0")
+ def release: ReleaseInfo = Process.release
+ @deprecated("use Process object instead", "0.9.0")
+ def stderr: WriteStream = Process.stderr
+ @deprecated("use Process object instead", "0.9.0")
+ def stdin: ReadStream = Process.stdin
+ @deprecated("use Process object instead", "0.9.0")
+ def stdout: WriteStream = Process.stdout
+ @deprecated("use Process object instead", "0.9.0")
+ def title: String = Process.title
+ @deprecated("use Process object instead", "0.9.0")
+ def version: String = Process.version
+ @deprecated("use Process object instead", "0.9.0")
+ def versions: ComponentVersion = Process.versions
+
+ @deprecated("use Process object instead", "0.9.0")
+ def abort(): Unit = Process.abort()
+ @deprecated("use Process object instead", "0.9.0")
+ def chdir(directory: String): Unit = Process.chdir(directory)
+ @deprecated("use Process object instead", "0.9.0")
+ def cwd(): String = Process.cwd()
+ @deprecated("use Process object instead", "0.9.0")
+ def disconnect(): js.Any = Process.disconnect()
+ @deprecated("use Process object instead", "0.9.0")
+ def emitWarning(warning: String, name: String = null, code: String = null, ctor: js.Function = null): Unit =
+ Process.emitWarning(warning, name, code, ctor)
+ @deprecated("use Process object instead", "0.9.0")
+ def exit(code: Int = 0): Unit = Process.exit(code)
+ @deprecated("use Process object instead", "0.9.0")
+ def getegid(): Int = Process.getegid()
+ @deprecated("use Process object instead", "0.9.0")
+ def geteuid(): Int = Process.geteuid()
+ @deprecated("use Process object instead", "0.9.0")
+ def getgid(): Int = Process.getgid()
+ @deprecated("use Process object instead", "0.9.0")
+ def getgroups(): js.Array[Int] = Process.getgroups()
+ @deprecated("use Process object instead", "0.9.0")
+ def getuid(): Int = Process.getuid()
+ @deprecated("use Process object instead", "0.9.0")
+ def hrtime(time: js.Array[Int] = null): js.Array[Int] = Process.hrtime(time)
+ @deprecated("use Process object instead", "0.9.0")
+ def initgroups(user: String, extra_group: String): js.Array[Int] = Process.initgroups(user, extra_group)
+ @deprecated("use Process object instead", "0.9.0")
+ def kill(pid: Int, signal: String = null): Unit = Process.kill(pid, signal)
+ @deprecated("use Process object instead", "0.9.0")
+ def memoryUsage(): MemoryUsage = Process.memoryUsage()
+ @deprecated("use Process object instead", "0.9.0")
+ def nextTick(callback: js.Function0[Any], args: js.Any*): Unit = Process.nextTick(callback, args)
+ @deprecated("use Process object instead", "0.9.0")
+ def openStdin(): ReadStream = Process.openStdin()
+ @deprecated("use Process object instead", "0.9.0")
+ def send(message: js.Any, sendHandle: SendHandle, options: TransferOptions, callback: js.Function): Boolean =
+ Process.send(message, sendHandle, options, callback)
+ @deprecated("use Process object instead", "0.9.0")
+ def send(message: js.Any, sendHandle: SendHandle, options: TransferOptions): Boolean =
+ Process.send(message, sendHandle, options)
+ @deprecated("use Process object instead", "0.9.0")
+ def send(message: js.Any, sendHandle: SendHandle, callback: js.Function): Boolean =
+ Process.send(message, sendHandle, callback)
+ @deprecated("use Process object instead", "0.9.0")
+ def send(message: js.Any, callback: js.Function): Boolean = Process.send(message, callback)
+ @deprecated("use Process object instead", "0.9.0")
+ def send(message: js.Any): Boolean = Process.send(message)
+ @deprecated("use Process object instead", "0.9.0")
+ def setegid(id: Int): Unit = Process.setegid(id)
+ @deprecated("use Process object instead", "0.9.0")
+ def seteuid(id: Int): Unit = Process.seteuid(id)
+ @deprecated("use Process object instead", "0.9.0")
+ def setgid(id: Int): Unit = Process.setgid(id)
+ @deprecated("use Process object instead", "0.9.0")
+ def setgroups(groups: js.Array[Int] | js.Array[String] | js.Array[String | Int]): Unit = Process.setgroups(groups)
+ @deprecated("use Process object instead", "0.9.0")
+ def setuid(id: Int): Unit = Process.setuid(id)
+ @deprecated("use Process object instead", "0.9.0")
+ def umask(mask: Int): Int = Process.umask(mask)
+ @deprecated("use Process object instead", "0.9.0")
+ def umask(): Int = Process.umask()
+ @deprecated("use Process object instead", "0.9.0")
+ def uptime(): Int = Process.uptime()
+
+ /**
+ * Process Environment Extensions
+ * @param env the given environment dictionary
+ */
+ implicit final class ProcessEnvExtensions(val env: Environment) extends AnyVal {
+ def `_` : String = env("_")
+ def __avn_active_file: String = env("__avn_active_file")
+ def __INTELLIJ_COMMAND_HISTFILE__ : String = env("__INTELLIJ_COMMAND_HISTFILE__")
+ def CLUTTER_BACKEND: String = env("CLUTTER_BACKEND")
+ def CLUTTER_IM_MODULE: String = env("CLUTTER_IM_MODULE")
+ def DBUS_SESSION_BUS_ADDRESS: String = env("DBUS_SESSION_BUS_ADDRESS")
+ def DEFAULTS_PATH: String = env("DEFAULTS_PATH")
+ def DESKTOP_SESSION: String = env("DESKTOP_SESSION")
+ def DISPLAY: String = env("DISPLAY")
+ def EDITOR: String = env("EDITOR")
+ def GDM_LANG: String = env("GDM_LANG")
+ def GDMSESSION: String = env("GDMSESSION")
+ def GLADE_CATALOG_PATH: String = env("GLADE_CATALOG_PATH")
+ def GLADE_MODULE_PATH: String = env("GLADE_MODULE_PATH")
+ def GLADE_PIXMAP_PATH: String = env("GLADE_PIXMAP_PATH")
+ def GOROOT: String = env("GOROOT")
+ def GPG_AGENT_INFO: String = env("GPG_AGENT_INFO")
+ def GREP_COLOR: String = env("GREP_COLOR")
+ def GREP_COLORS: String = env("GREP_COLORS")
+ def GTK_IM_MODULE: String = env("GTK_IM_MODULE")
+ def GTK_OVERLAY_SCROLLING: String = env("GTK_OVERLAY_SCROLLING")
+ def HOME: String = env("HOME")
+ def LANG: String = env("LANG")
+ def LANGUAGE: String = env("LANGUAGE")
+ def LC_ADDRESS: String = env("LC_ADDRESS")
+ def LC_IDENTIFICATION: String = env("LC_IDENTIFICATION")
+ def LC_MEASUREMENT: String = env("LC_MEASUREMENT")
+ def LC_MONETARY: String = env("LC_MONETARY")
+ def LC_NAME: String = env("LC_NAME")
+ def LC_NUMERIC: String = env("LC_NUMERIC")
+ def LC_PAPER: String = env("LC_PAPER")
+ def LC_TELEPHONE: String = env("LC_TELEPHONE")
+ def LC_TIME: String = env("LC_TIME")
+ def LESS: String = env("LESS")
+ def LESS_TERMCAP_mb: String = env("LESS_TERMCAP_mb")
+ def LESS_TERMCAP_md: String = env("LESS_TERMCAP_md")
+ def LESS_TERMCAP_me: String = env("LESS_TERMCAP_me")
+ def LESS_TERMCAP_se: String = env("LESS_TERMCAP_se")
+ def LESS_TERMCAP_so: String = env("LESS_TERMCAP_so")
+ def LESS_TERMCAP_ue: String = env("LESS_TERMCAP_ue")
+ def LESS_TERMCAP_us: String = env("LESS_TERMCAP_us")
+ def LESSOPEN: String = env("LESSOPEN")
+ def LOGNAME: String = env("LOGNAME")
+ def LS_COLORS: String = env("LS_COLORS")
+ def M2: String = env("M2")
+ def M2_HOME: String = env("M2_HOME")
+ def MANDATORY_PATH: String = env("MANDATORY_PATH")
+ def NODE_DEBUG: js.UndefOr[String] = env.get("NODE_DEBUG").orUndefined
+ def NODE_ENV: js.UndefOr[String] = env.get("NODE_ENV").orUndefined
+ def OLDPWD: String = env("OLDPWD")
+ def PAGER: String = env("PAGER")
+ def PAPERSIZE: String = env("PAPERSIZE")
+ def PATH: String = env("PATH")
+ def PWD: String = env("PWD")
+ def QT4_IM_MODULE: String = env("QT4_IM_MODULE")
+ def QT_ACCESSIBILITY: String = env("QT_ACCESSIBILITY")
+ def QT_IM_MODULE: String = env("QT_IM_MODULE")
+ def QT_QPA_PLATFORMTHEME: String = env("QT_QPA_PLATFORMTHEME")
+ def SESSION_MANAGER: String = env("SESSION_MANAGER")
+ def SHELL: String = env("SHELL")
+ def SHLVL: String = env("SHLVL")
+ def SSH_AGENT_PID: String = env("SSH_AGENT_PID")
+ def SSH_AUTH_SOCK: String = env("SSH_AUTH_SOCK")
+ def TERM: String = env("TERM")
+ def TERMINAL_EMULATOR: String = env("TERMINAL_EMULATOR")
+ def TMPDIR: js.UndefOr[String] = env.get("TMPDIR").orUndefined
+ def USER: String = env("USER")
+ def VISUAL: String = env("VISUAL")
+ def XAUTHORITY: String = env("XAUTHORITY")
+ def XDG_CONFIG_DIRS: String = env("XDG_CONFIG_DIRS")
+ def XDG_CURRENT_DESKTOP: String = env("XDG_CURRENT_DESKTOP")
+ def XDG_DATA_DIRS: String = env("XDG_DATA_DIRS")
+ def XDG_GREETER_DATA_DIR: String = env("XDG_GREETER_DATA_DIR")
+ def XDG_MENU_PREFIX: String = env("XDG_MENU_PREFIX")
+ def XDG_RUNTIME_DIR: String = env("XDG_RUNTIME_DIR")
+ def XDG_SEAT: String = env("XDG_SEAT")
+ def XDG_SEAT_PATH: String = env("XDG_SEAT_PATH")
+ def XDG_SESSION_DESKTOP: String = env("XDG_SESSION_DESKTOP")
+ def XDG_SESSION_ID: String = env("XDG_SESSION_ID")
+ def XDG_SESSION_PATH: String = env("XDG_SESSION_PATH")
+ def XDG_SESSION_TYPE: String = env("XDG_SESSION_TYPE")
+ def XDG_VTNR: String = env("XDG_VTNR")
+ def XMODIFIERS: String = env("XMODIFIERS")
+ def ZDOTDIR: String = env("ZDOTDIR")
+ }
+
+ /**
+ * Process Object Extensions
+ * @param process the given [[Process process]]
+ */
+ implicit final class ProcessExtensions(private val process: Process) extends AnyVal {
+ @inline
+ def sendFuture(message: js.Any, sendHandle: SendHandle, options: TransferOptions): Future[Boolean] = {
+ promiseWithError1[Error, Boolean](process.send(message, sendHandle, options, _))
+ }
+
+ @inline
+ def sendFuture(message: js.Any, sendHandle: SendHandle): Future[Boolean] = {
+ promiseWithError1[Error, Boolean](process.send(message, sendHandle, _))
+ }
+
+ @inline
+ def sendFuture(message: js.Any): Future[Boolean] = {
+ promiseWithError1[Error, Boolean](process.send(message, _))
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////
+ // Events
+ /////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * This event is emitted when Node.js empties its event loop and has nothing else to schedule. Normally, Node.js
+ * exits when there is no work scheduled, but a listener for 'beforeExit' can make asynchronous calls, and cause
+ * Node.js to continue.
+ *
+ * 'beforeExit' is not emitted for conditions causing explicit termination, such as process.exit() or uncaught
+ * exceptions, and should not be used as an alternative to the 'exit' event unless the intention is to schedule
+ * more work.
+ * @param listener the event listener function
+ * @since 0.11.12
+ */
+ def onBeforeExit(listener: ExitCode => Any): Process = process.on("beforeExit", listener)
+
+ /**
+ * If process is spawned with an IPC channel, 'disconnect' will be emitted when IPC channel is closed.
+ * Read more in child_process 'disconnect' event doc.
+ * @param listener the event listener function
+ * @since 0.7.7
+ */
+ def onDisconnect(listener: () => Any): Process = process.on("disconnect", listener)
+
+ /**
+ * Emitted when the process is about to exit. There is no way to prevent the exiting of the event loop at this point,
+ * and once all 'exit' listeners have finished running the process will exit. Therefore you must only perform
+ * synchronous operations in this handler. This is a good hook to perform checks on the module's state (like for
+ * unit tests). The callback takes one argument, the code the process is exiting with.
+ * @param listener the event listener function
+ * @example process.on('exit', (code) => { ... })
+ * @since 0.1.7
+ */
+ def onExit(listener: ExitCode => Any): Process = process.on("exit", listener)
+
+ /**
+ * Messages sent by ChildProcess.send() are obtained using the 'message' event on the child's process object.
+ * @param listener the event listener function
+ *
+ *
message:
+ *
sendHandle: a net.Socket or net.Server object, or undefined.
+ *
+ * @since 0.5.10
+ */
+ def onMessage(listener: (js.Any, js.UndefOr[net.Server | net.Socket]) => Any): Process =
+ process.on("message", listener)
+
+ @enableIf(io.scalajs.nodejs.CompilerSwitches.gteNodeJs10)
+ def onMultipleResolves[T](listener: (String, js.Promise[T], js.Any) => Any): Process =
+ process.on("multipleResolves", listener)
+
+ /**
+ * Emitted whenever a Promise was rejected and an error handler was attached to it (for example with promise.catch())
+ * later than after an event loop turn.
+ * @param listener the event listener function
+ */
+ def onRejectionHandled[T](listener: js.Promise[T] => Any): Process = process.on("rejectionHandled", listener)
+
+ /**
+ * The 'uncaughtException' event is emitted when an exception bubbles all the way back to the event loop. By default,
+ * Node.js handles such exceptions by printing the stack trace to stderr and exiting. Adding a handler for the
+ * 'uncaughtException' event overrides this default behavior.
+ * @param listener the event listener function
+ */
+ def onUncaughtException(listener: Error => Any): Process = process.on("uncaughtException", listener)
+
+ @enableIf(io.scalajs.nodejs.CompilerSwitches.gteNodeJs12)
+ def onUncaughtException(listener: (Error, String) => Any): Process = process.on("uncaughtException", listener)
+
+ /**
+ * Emitted whenever a Promise is rejected and no error handler is attached to the promise within a turn of the event
+ * loop. When programming with promises exceptions are encapsulated as rejected promises. Such promises can be caught
+ * and handled using promise.catch() and rejections are propagated through a promise chain. This event is useful for
+ * detecting and keeping track of promises that were rejected whose rejections were not handled yet.
+ * @param listener the event listener function
+ */
+ def onUnhandledRejection[T](listener: (js.Any, js.Promise[T]) => Any): Process =
+ process.on("unhandledRejection", listener)
+
+ /**
+ * A process warning is similar to an error in that it describes exceptional conditions that are being brought to
+ * the user's attention. However, warnings are not part of the normal Node.js and JavaScript error handling flow.
+ * Node.js can emit warnings whenever it detects bad coding practices that could lead to sub-optimal application
+ * performance, bugs or security vulnerabilities.
+ *
+ * The event handler for 'warning' events is called with a single warning argument whose value is an Error object.
+ * @param listener the event listener function
+ */
+ def onWarning(listener: Warning => Any): Process = process.on("warning", listener)
+
+ /////////////////////////////////////////////////////////////////////////////////
+ // Signal Events - Emitted when the processes receives a signal.
+ // See sigaction(2) for a list of standard POSIX signal names
+ // such as SIGINT, SIGHUP, etc.
+ /////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * An easy way to send the SIGINT signal is with Control-C in most terminal programs.
+ * @param listener the event listener function
+ */
+ def onSIGINT(listener: () => Any): Process = process.on("SIGINT", listener)
+
+ /**
+ * SIGUSR1 is reserved by Node.js to start the debugger. It's possible to install a listener but that won't stop
+ * the debugger from starting.
+ * @param listener the event listener function
+ */
+ def onSIGUSR1(listener: () => Any): Process = process.on("SIGUSR1", listener)
+
+ def onSIGTERM(listener: () => Any): Process = process.on("SIGTERM", listener)
+ def onSIGHUP(listener: () => Any): Process = process.on("SIGHUP", listener)
+ def onSIGBREAK(listener: () => Any): Process = process.on("SIGBREAK", listener)
+ def onSIGWINCH(listener: () => Any): Process = process.on("SIGWINCH", listener)
+ def onSIGBUS(listener: () => Any): Process = process.on("SIGBUS", listener)
+ def onSIGFPE(listener: () => Any): Process = process.on("SIGFPE", listener)
+ def onSIGSEGV(listener: () => Any): Process = process.on("SIGSEGV", listener)
+ def onSIGILL(listener: () => Any): Process = process.on("SIGILL", listener)
+ }
+
+}
diff --git a/app/current/src/main/scala/io/scalajs/nodejs/repl/package.scala b/app/current/src/main/scala/io/scalajs/nodejs/repl/package.scala
index 109a88299..081ddc5c3 100644
--- a/app/current/src/main/scala/io/scalajs/nodejs/repl/package.scala
+++ b/app/current/src/main/scala/io/scalajs/nodejs/repl/package.scala
@@ -47,7 +47,7 @@ package object repl {
*
NODE_REPL_MODE
*
*/
- final implicit class EnvironmentVariableOptions(val env: Environment) extends AnyVal {
+ final implicit class EnvironmentVariableOptions(val env: process.Environment) extends AnyVal {
/**
* When a valid path is given, persistent REPL history will be saved to the specified file rather
diff --git a/app/nodejs-v10/src/test/scala/io/scalajs/nodejs/ConsoleTest.scala b/app/nodejs-v10/src/test/scala/io/scalajs/nodejs/ConsoleTest.scala
index 1381d6c30..4fdbc5f8e 100644
--- a/app/nodejs-v10/src/test/scala/io/scalajs/nodejs/ConsoleTest.scala
+++ b/app/nodejs-v10/src/test/scala/io/scalajs/nodejs/ConsoleTest.scala
@@ -28,7 +28,7 @@ class ConsoleTest extends FunSpec with BeforeAndAfterEach {
it("have constructor(options) added in v10.0.0") {
val console = new Console(
new ConsoleOptions(
- stdout = io.scalajs.nodejs.process.stdout
+ stdout = io.scalajs.nodejs.process.Process.stdout
)
)
diff --git a/app/nodejs-v10/src/test/scala/io/scalajs/nodejs/process/ProcessTest.scala b/app/nodejs-v10/src/test/scala/io/scalajs/nodejs/process/ProcessTest.scala
new file mode 100644
index 000000000..399d5f9d2
--- /dev/null
+++ b/app/nodejs-v10/src/test/scala/io/scalajs/nodejs/process/ProcessTest.scala
@@ -0,0 +1,15 @@
+package io.scalajs.nodejs.process
+
+import org.scalatest.FunSpec
+
+class ProcessTest extends FunSpec{
+
+ describe("Process") {
+ it("hrtime.bigint") {
+ // TODO: js.BigInt
+ val value = Process.hrtime.bigint()
+ assert(value.toString().matches("^\\d+$"))
+ }
+ }
+
+}
diff --git a/app/nodejs-v8/src/test/scala/io/scalajs/nodejs/ProcessTest.scala b/app/nodejs-v8/src/test/scala/io/scalajs/nodejs/ProcessTest.scala
deleted file mode 100644
index 3b12e316e..000000000
--- a/app/nodejs-v8/src/test/scala/io/scalajs/nodejs/ProcessTest.scala
+++ /dev/null
@@ -1,45 +0,0 @@
-package io.scalajs.nodejs
-
-import io.scalajs.nodejs.Process.ProcessEnvExtensions
-import io.scalajs.nodejs.os.OS
-import org.scalatest.FunSpec
-
-import scala.scalajs.js
-
-/**
- * Process Tests
- */
-class ProcessTest extends FunSpec {
-
- describe("Process") {
- val versionPrefix =
- if (TestEnvironment.isExecutedInExactNode8) "v8."
- else if (TestEnvironment.isExecutedInExactNode10) "v10."
- else if (TestEnvironment.isExecutedInExactNode12) "v12."
- else "Unknown node.js version"
-
- it("contains the following properties") {
- assert(process.arch.isInstanceOf[String])
- assert(process.argv.length === 1)
- assert(process.argv(0).endsWith("node"))
- assert(process.config("variables").asInstanceOf[js.Dictionary[String]]("host_arch") === OS.arch())
- assert(process.connected.isEmpty)
- assert(process.cwd().nonEmpty)
- assert(process.env("PATH").nonEmpty)
- assert(process.env.PATH === process.env("PATH"))
- assert(process.execArgv.length === 0)
- assert(process.execPath.endsWith("node"))
- assert(process.features.contains("debug"))
- assert(process.moduleLoadList.length > 0)
- assert(process.title.isInstanceOf[String])
- assert(process.version.startsWith(versionPrefix))
- assert(process.versions.node.map(v => s"v${v}").getOrElse("").startsWith(versionPrefix))
-
- // TODO: actually undefined in test
- // assert(process.stdout.isTTY)
- // assert(process.stderr.isTTY)
- }
-
- }
-
-}
diff --git a/app/nodejs-v8/src/test/scala/io/scalajs/nodejs/process/ProcessTest.scala b/app/nodejs-v8/src/test/scala/io/scalajs/nodejs/process/ProcessTest.scala
new file mode 100644
index 000000000..5e2912c83
--- /dev/null
+++ b/app/nodejs-v8/src/test/scala/io/scalajs/nodejs/process/ProcessTest.scala
@@ -0,0 +1,46 @@
+package io.scalajs.nodejs.process
+
+import io.scalajs.nodejs.os.OS
+import io.scalajs.nodejs.TestEnvironment
+import org.scalatest.FunSpec
+
+class ProcessTest extends FunSpec {
+
+ describe("Process") {
+ val versionPrefix =
+ if (TestEnvironment.isExecutedInExactNode8) "v8."
+ else if (TestEnvironment.isExecutedInExactNode10) "v10."
+ else if (TestEnvironment.isExecutedInExactNode12) "v12."
+ else "Unknown node.js version"
+
+ it("contains the following properties") {
+ assert(Process.arch.isInstanceOf[String])
+ assert(Process.argv.length === 1)
+ assert(Process.argv(0).endsWith("node"))
+ assert(Process.config.variables.host_arch === OS.arch())
+ assert(Process.connected.isEmpty)
+ assert(Process.cwd().nonEmpty)
+ assert(Process.env("PATH").nonEmpty)
+ assert(Process.env.PATH === Process.env("PATH"))
+ assert(Process.execArgv.length === 0)
+ assert(Process.execPath.endsWith("node"))
+ assert(Process.features.contains("debug"))
+ assert(Process.moduleLoadList.length > 0)
+ assert(Process.title.isInstanceOf[String])
+ assert(Process.version.startsWith(versionPrefix))
+ assert(s"v${Process.versions.node}".startsWith(versionPrefix))
+
+ // TODO: actually undefined in test
+ // assert(process.stdout.isTTY)
+ // assert(process.stderr.isTTY)
+ }
+
+ it("hrtime") {
+ val value = Process.hrtime()
+ assert(value.length === 2)
+ val diff = Process.hrtime(value)
+ assert(diff.length === 2)
+ assert(diff(0) === 0)
+ }
+ }
+}
diff --git a/app/nodejs-v8/src/test/scala/io/scalajs/nodejs/readline/ReadlineTest.scala b/app/nodejs-v8/src/test/scala/io/scalajs/nodejs/readline/ReadlineTest.scala
index 0a9134b4a..607afe842 100644
--- a/app/nodejs-v8/src/test/scala/io/scalajs/nodejs/readline/ReadlineTest.scala
+++ b/app/nodejs-v8/src/test/scala/io/scalajs/nodejs/readline/ReadlineTest.scala
@@ -1,7 +1,7 @@
package io.scalajs.nodejs.readline
import io.scalajs.nodejs.fs.Fs
-import io.scalajs.nodejs.process
+import io.scalajs.nodejs.process.Process
import org.scalatest.AsyncFunSpec
import scala.concurrent.{ExecutionContext, Promise}
@@ -21,7 +21,7 @@ class ReadlineTest extends AsyncFunSpec {
val reader = Readline.createInterface(
new ReadlineOptions(
input = Fs.createReadStream(file),
- output = process.stdout,
+ output = Process.stdout,
terminal = false
)
)
@@ -38,7 +38,7 @@ class ReadlineTest extends AsyncFunSpec {
it("has REPL-like functionality") {
val promise = Promise[Unit]()
- val rl = Readline.createInterface(new ReadlineOptions(input = process.stdin, output = process.stdout))
+ val rl = Readline.createInterface(new ReadlineOptions(input = Process.stdin, output = Process.stdout))
rl.setPrompt("OHAI> ")
rl.prompt()