-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
150 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.scalajs.nodejs | ||
|
||
import scala.scalajs.js | ||
|
||
/** | ||
* os package object | ||
* @author [email protected] | ||
*/ | ||
package object os { | ||
|
||
/** | ||
* CPU Info Enrichment | ||
* @param cpuInfo the given [[CPUInfo CPU Info]] | ||
*/ | ||
final implicit class CPUInfoEnrichment(val cpuInfo: CPUInfo) extends AnyVal { | ||
|
||
@inline | ||
def timesObject: js.Array[CPUTime] = cpuInfo.times.asInstanceOf[js.Array[CPUTime]] | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package io.scalajs.nodejs.punycode | ||
|
||
import scala.scalajs.js | ||
import scala.scalajs.js.annotation.JSImport | ||
|
||
/** | ||
* The version of the punycode module bundled in Node.js is being deprecated. In a future major version of Node.js | ||
* this module will be removed. Users currently depending on the punycode module should switch to using the | ||
* userland-provided Punycode.js module instead. | ||
* @see https://nodejs.org/dist/latest-v7.x/docs/api/punycode.html | ||
*/ | ||
@js.native | ||
trait Punycode extends js.Object { | ||
|
||
/** | ||
* The punycode.decode() method converts a Punycode string of ASCII-only characters to the equivalent | ||
* string of Unicode codepoints. | ||
* @param string a Punycode string of ASCII-only characters | ||
* @return the equivalent string of Unicode codepoints. | ||
*/ | ||
def decode(string: String): String = js.native | ||
|
||
/** | ||
* The punycode.encode() method converts a string of Unicode codepoints to a Punycode string of ASCII-only characters. | ||
* @param codePoints a string of Unicode codepoints | ||
* @return a Punycode string of ASCII-only characters. | ||
*/ | ||
def encode(codePoints: String): String = js.native | ||
|
||
/** | ||
* The punycode.toASCII() method converts a Unicode string representing an Internationalized Domain Name to Punycode. | ||
* Only the non-ASCII parts of the domain name will be converted. Calling punycode.toASCII() on a string that already | ||
* only contains ASCII characters will have no effect. | ||
* @param domain the domain name | ||
* @return a Unicode string representing an Internationalized Domain Name as Punycode | ||
*/ | ||
def toASCII(domain: String): String = js.native | ||
|
||
/** | ||
* The punycode.toUnicode() method converts a string representing a domain name containing Punycode encoded | ||
* characters into Unicode. Only the Punycode encoded parts of the domain name are be converted. | ||
* @param domain a string representing a domain name containing Punycode encoded characters | ||
* @return the Unicode string | ||
*/ | ||
def toUnicode(domain: String): String = js.native | ||
|
||
/** | ||
* The UCS2 object | ||
* @return The [[UCS2 UCS2]] object | ||
*/ | ||
def ucs2: UCS2 = js.native | ||
|
||
/** | ||
* Returns a string identifying the current Punycode.js version number. | ||
* @return a string identifying the current Punycode.js version number. | ||
*/ | ||
def version: String = js.native | ||
|
||
} | ||
|
||
/** | ||
* Punycode.UCS2 | ||
* @see https://nodejs.org/dist/latest-v7.x/docs/api/punycode.html | ||
*/ | ||
@js.native | ||
trait UCS2 extends js.Object { | ||
|
||
/** | ||
* The punycode.ucs2.decode() method returns an array containing the numeric codepoint values of each Unicode | ||
* symbol in the string. | ||
* @param string the string containing Unicode symbols | ||
* @return an array containing the numeric codepoint values of each Unicode symbol | ||
*/ | ||
def decode(string: String): js.Array[Int] = js.native | ||
|
||
/** | ||
* The punycode.ucs2.encode() method returns a string based on an array of numeric code point values. | ||
* @param codePoints an array of numeric code point values | ||
* @return a string based on an array of numeric code point values | ||
*/ | ||
def encode(codePoints: js.Array[Int]): String = js.native | ||
|
||
} | ||
|
||
@js.native | ||
@JSImport("punycode", JSImport.Namespace) | ||
object Punycode extends Punycode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,29 +138,32 @@ trait Writable extends IEventEmitter { | |
/** | ||
* Flush all data, buffered since stream.cork() call. | ||
* @param chunk The data to write (<String> | <Buffer>) | ||
* @param encoding The encoding, if chunk is a String | ||
* @param callback the Callback for when this chunk of data is flushed | ||
* @return true, if the data was handled completely | ||
* @example writable.write(chunk[, encoding][, callback]) | ||
*/ | ||
def write(chunk: String, encoding: String, callback: js.Function1[Error, Any]): Boolean = js.native | ||
def write(chunk: Buffer | String, callback: js.Function1[Error, Any] = js.native): Boolean = js.native | ||
|
||
/** | ||
* Flush all data, buffered since stream.cork() call. | ||
* @param chunk The data to write (<String> | <Buffer>) | ||
* @param callback the Callback for when this chunk of data is flushed | ||
* @param encoding The encoding, if chunk is a String | ||
* @return true, if the data was handled completely | ||
* @example writable.write(chunk[, encoding][, callback]) | ||
*/ | ||
def write(chunk: String, callback: js.Function1[Error, Any]): Boolean = js.native | ||
def write(chunk: Buffer | String, encoding: String): Boolean = js.native | ||
|
||
/** | ||
* Flush all data, buffered since stream.cork() call. | ||
* @param chunk The data to write (<String> | <Buffer>) | ||
* @param chunk The data to write (<String> | <Buffer>) | ||
* @param encoding The encoding, if chunk is a String | ||
* @param callback the Callback for when this chunk of data is flushed | ||
* @return true, if the data was handled completely | ||
* @example writable.write(chunk[, encoding][, callback]) | ||
*/ | ||
def write(chunk: Buffer, callback: js.Function1[Error, Any]): Boolean = js.native | ||
def write(chunk: Buffer | String, | ||
encoding: String, | ||
callback: js.Function1[Error, Any]): Boolean = js.native | ||
|
||
} | ||
|
||
|
@@ -174,7 +177,7 @@ object Writable { | |
* Writable Events | ||
* @author [email protected] | ||
*/ | ||
implicit class WritableEvents(val writable: Writable) extends AnyVal { | ||
implicit class WritableEvents[T <: Writable](val writable: T) extends AnyVal { | ||
|
||
/** | ||
* Emitted when the stream and any of its underlying resources (a file descriptor, for example) have been closed. | ||
|
@@ -223,7 +226,7 @@ object Writable { | |
* Writable Extensions | ||
* @author [email protected] | ||
*/ | ||
implicit class WritableExtensions(val writable: Writable) extends AnyVal { | ||
implicit class WritableExtensions[T <: Writable](val writable: T) extends AnyVal { | ||
|
||
@inline | ||
def endAsync(chunk: Buffer): Promise[Unit] = promiseWithError0[Error](writable.end(chunk, _)) | ||
|
@@ -237,10 +240,7 @@ object Writable { | |
def endAsync(): Promise[Unit] = promiseWithError0[Error](writable.end) | ||
|
||
@inline | ||
def writeAsync(chunk: Buffer): Promise[Unit] = promiseWithError0[Error](writable.write(chunk, _)) | ||
|
||
@inline | ||
def writeAsync(chunk: String, encoding: String = null): Promise[Unit] = { | ||
def writeAsync(chunk: Buffer | String, encoding: String = null): Promise[Unit] = { | ||
promiseWithError0[Error](writable.write(chunk, encoding, _)) | ||
} | ||
|
||
|
@@ -254,5 +254,6 @@ object Writable { | |
* @param encoding the data's optional encoding | ||
*/ | ||
@ScalaJSDefined | ||
class Chunk(val chunk: Buffer | String, val encoding: js.UndefOr[String] = js.undefined) | ||
class Chunk(val chunk: Buffer | String, | ||
val encoding: js.UndefOr[String] = js.undefined) | ||
extends js.Object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.