Skip to content

Commit

Permalink
Pre-release v0.4.0-pre3:
Browse files Browse the repository at this point in the history
Miscellaneous fixes in OS and Stream packages
  • Loading branch information
ldaniels528 committed Apr 7, 2017
1 parent 890f0ce commit 8a3fa38
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 36 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ The following applications were developed using ScalaJs.io:
| Application | Frontend | Backend | Scalajs.io version | Description |
|------------------------------------------------------------------------|-----------------------|--------------------|--------------------|------------------------------------------|
| [Phaser-Invaders](https://github.com/scalajs-io/phaser-invaders-demo) | Scala.js + DOM | Scala + NodeJS | 0.3.0.1 | Port of Phaser Invaders. |
| [Socialize](https://github.com/ldaniels528/scalajs-nodejs-socialized) | Scala.js + AngularJS | Scala.js + NodeJS | 0.3.0.3 | A Facebook-inspired Social networking web application. |
| [Todo MVC](https://github.com/ldaniels528/scalajs-nodejs-todomvc) | Scala.js + AngularJS | Scala.js + NodeJS | 0.2.3.1 | A simple Todo example application. |
| [Trifecta](https://github.com/ldaniels528/trifecta) | Scala.js + AngularJS | Scala + Play 2.4.x | 0.3.0.0 | Trifecta is a web-based and CLI tool that simplifies inspecting Kafka messages and Zookeeper data. |
| [Socialize](https://github.com/scalajs-io/scalajs-nodejs-socialized) | Scala.js + AngularJS | Scala.js + NodeJS | 0.3.0.3 | A Facebook-inspired Social networking web application. |
| [Todo MVC](https://github.com/scalajs-io/scalajs-nodejs-todomvc) | Scala.js + AngularJS | Scala.js + NodeJS | 0.2.3.1 | A simple Todo example application. |
| [Trifecta](https://github.com/scalajs-io/trifecta) | Scala.js + AngularJS | Scala + Play 2.4.x | 0.3.0.0 | Trifecta is a web-based and CLI tool that simplifies inspecting Kafka messages and Zookeeper data. |

### The MEAN Stack — AngularJS, MongoDB, Mongoose, Express and more

Expand Down Expand Up @@ -231,7 +231,7 @@ The following core Node.js modules (v7.7.1) have been implemented:
| vm | The vm module provides APIs for compiling and running code within V8 Virtual Machine contexts.|
| zlib | This provides bindings to Gzip/Gunzip, Deflate/Inflate, and DeflateRaw/InflateRaw classes. |

*NOTE*: The SBT artifact for the complete Node.js platform is: "io.scalajs.npm" %%% "nodejs" % "0.4.0-pre2"
*NOTE*: The SBT artifact for the complete Node.js platform is: "io.scalajs.npm" %%% "nodejs" % "0.4.0-pre3"

<a name="npm_modules">
#### Third-party Modules
Expand Down Expand Up @@ -298,7 +298,7 @@ The following Third Party/OSS Node.js (npm) modules have been implemented:
| [winston-daily-rotate-file](https://github.com/scalajs-io/winston-daily-rotate-file) | 1.4.4 | A multi-transport async logging library for Node.js. |
| [xml2js](https://github.com/scalajs-io/xml2js) | 0.4.16 | Simple XML to JavaScript object converter. |

*NOTE*: The full SBT artifact expression is: "io.scalajs.npm" %%% "xxxx" % version (e.g. "io.scalajs.npm" %%% "express" % "0.4.0-pre2")
*NOTE*: The full SBT artifact expression is: "io.scalajs.npm" %%% "xxxx" % version (e.g. "io.scalajs.npm" %%% "express" % "0.4.0-pre3")

I've provided an example to demonstrate how similar the Scala.js code is to the JavaScript
that it replaces.
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sbt._

import scala.language.postfixOps

val scalaJsIOVersion = "0.4.0-pre2"
val scalaJsIOVersion = "0.4.0-pre3"
val apiVersion = scalaJsIOVersion
val scalaJsVersion = "2.12.1"

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nodejs-sfs",
"version": "0.4.0-pre2",
"version": "0.4.0-pre3",
"private": true,
"dependencies": {
"source-map": "^0.5.6"
Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/io/scalajs/nodejs/os/CPUInfo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import scala.scalajs.js
*/
@js.native
trait CPUInfo extends js.Object {
var model: String = js.native
var speed: Double = js.native
var times: js.Array[CPUTime] = js.native
var model: String = js.native
var speed: Double = js.native
var times: js.Dictionary[Double] = js.native
}
2 changes: 1 addition & 1 deletion src/main/scala/io/scalajs/nodejs/os/OS.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ trait OS extends js.Object {
* spent in: user, nice, sys, idle, and irq).
* @example os.cpus()
*/
def cpus(): js.Array[js.Any] = js.native
def cpus(): js.Array[CPUInfo] = js.native

/**
* Returns the endianness of the CPU. Possible values are 'BE' for big endian or 'LE' for little endian.
Expand Down
22 changes: 22 additions & 0 deletions src/main/scala/io/scalajs/nodejs/os/package.scala
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]]

}

}
32 changes: 8 additions & 24 deletions src/main/scala/io/scalajs/nodejs/stream/Writable.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package io.scalajs.nodejs
package stream

import io.scalajs.util.PromiseHelper._
import io.scalajs.util.PromiseHelper.Implicits._
import io.scalajs.nodejs.buffer.Buffer
import io.scalajs.nodejs.events.IEventEmitter
import io.scalajs.util.PromiseHelper._

import scala.concurrent.Promise
import scala.scalajs.js
Expand Down Expand Up @@ -143,24 +144,9 @@ trait Writable extends IEventEmitter {
* @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

/**
* 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
* @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

/**
* Flush all data, buffered since stream.cork() call.
* @param chunk The data to write (<String> | <Buffer>)
* @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 = js.native,
callback: js.Function1[Error, Any] = js.native): Boolean = js.native

}

Expand Down Expand Up @@ -237,10 +223,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, _))
}

Expand All @@ -254,5 +237,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
2 changes: 1 addition & 1 deletion src/test/resources/watchfile.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scalajs-io",
"version": "0.4.0-pre2",
"version": "0.4.0-pre3",
"private": true,
"dependencies": {
"async": "^2.0.1",
Expand Down

0 comments on commit 8a3fa38

Please sign in to comment.