Skip to content

Commit 8a3fa38

Browse files
committed
Pre-release v0.4.0-pre3:
Miscellaneous fixes in OS and Stream packages
1 parent 890f0ce commit 8a3fa38

File tree

8 files changed

+42
-36
lines changed

8 files changed

+42
-36
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ The following applications were developed using ScalaJs.io:
7676
| Application | Frontend | Backend | Scalajs.io version | Description |
7777
|------------------------------------------------------------------------|-----------------------|--------------------|--------------------|------------------------------------------|
7878
| [Phaser-Invaders](https://github.com/scalajs-io/phaser-invaders-demo) | Scala.js + DOM | Scala + NodeJS | 0.3.0.1 | Port of Phaser Invaders. |
79-
| [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. |
80-
| [Todo MVC](https://github.com/ldaniels528/scalajs-nodejs-todomvc) | Scala.js + AngularJS | Scala.js + NodeJS | 0.2.3.1 | A simple Todo example application. |
81-
| [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. |
79+
| [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. |
80+
| [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. |
81+
| [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. |
8282

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

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

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

236236
<a name="npm_modules">
237237
#### Third-party Modules
@@ -298,7 +298,7 @@ The following Third Party/OSS Node.js (npm) modules have been implemented:
298298
| [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. |
299299
| [xml2js](https://github.com/scalajs-io/xml2js) | 0.4.16 | Simple XML to JavaScript object converter. |
300300

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

303303
I've provided an example to demonstrate how similar the Scala.js code is to the JavaScript
304304
that it replaces.

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import sbt._
55

66
import scala.language.postfixOps
77

8-
val scalaJsIOVersion = "0.4.0-pre2"
8+
val scalaJsIOVersion = "0.4.0-pre3"
99
val apiVersion = scalaJsIOVersion
1010
val scalaJsVersion = "2.12.1"
1111

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nodejs-sfs",
3-
"version": "0.4.0-pre2",
3+
"version": "0.4.0-pre3",
44
"private": true,
55
"dependencies": {
66
"source-map": "^0.5.6"

src/main/scala/io/scalajs/nodejs/os/CPUInfo.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import scala.scalajs.js
88
*/
99
@js.native
1010
trait CPUInfo extends js.Object {
11-
var model: String = js.native
12-
var speed: Double = js.native
13-
var times: js.Array[CPUTime] = js.native
11+
var model: String = js.native
12+
var speed: Double = js.native
13+
var times: js.Dictionary[Double] = js.native
1414
}

src/main/scala/io/scalajs/nodejs/os/OS.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ trait OS extends js.Object {
5050
* spent in: user, nice, sys, idle, and irq).
5151
* @example os.cpus()
5252
*/
53-
def cpus(): js.Array[js.Any] = js.native
53+
def cpus(): js.Array[CPUInfo] = js.native
5454

5555
/**
5656
* Returns the endianness of the CPU. Possible values are 'BE' for big endian or 'LE' for little endian.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package io.scalajs.nodejs
2+
3+
import scala.scalajs.js
4+
5+
/**
6+
* os package object
7+
* @author lawrence.daniels@gmail.com
8+
*/
9+
package object os {
10+
11+
/**
12+
* CPU Info Enrichment
13+
* @param cpuInfo the given [[CPUInfo CPU Info]]
14+
*/
15+
final implicit class CPUInfoEnrichment(val cpuInfo: CPUInfo) extends AnyVal {
16+
17+
@inline
18+
def timesObject: js.Array[CPUTime] = cpuInfo.times.asInstanceOf[js.Array[CPUTime]]
19+
20+
}
21+
22+
}

src/main/scala/io/scalajs/nodejs/stream/Writable.scala

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package io.scalajs.nodejs
22
package stream
33

4+
import io.scalajs.util.PromiseHelper._
5+
import io.scalajs.util.PromiseHelper.Implicits._
46
import io.scalajs.nodejs.buffer.Buffer
57
import io.scalajs.nodejs.events.IEventEmitter
6-
import io.scalajs.util.PromiseHelper._
78

89
import scala.concurrent.Promise
910
import scala.scalajs.js
@@ -143,24 +144,9 @@ trait Writable extends IEventEmitter {
143144
* @return true, if the data was handled completely
144145
* @example writable.write(chunk[, encoding][, callback])
145146
*/
146-
def write(chunk: String, encoding: String, callback: js.Function1[Error, Any]): Boolean = js.native
147-
148-
/**
149-
* Flush all data, buffered since stream.cork() call.
150-
* @param chunk The data to write (<String> | <Buffer>)
151-
* @param callback the Callback for when this chunk of data is flushed
152-
* @return true, if the data was handled completely
153-
* @example writable.write(chunk[, encoding][, callback])
154-
*/
155-
def write(chunk: String, callback: js.Function1[Error, Any]): Boolean = js.native
156-
157-
/**
158-
* Flush all data, buffered since stream.cork() call.
159-
* @param chunk The data to write (<String> | <Buffer>)
160-
* @return true, if the data was handled completely
161-
* @example writable.write(chunk[, encoding][, callback])
162-
*/
163-
def write(chunk: Buffer, callback: js.Function1[Error, Any]): Boolean = js.native
147+
def write(chunk: Buffer | String,
148+
encoding: String = js.native,
149+
callback: js.Function1[Error, Any] = js.native): Boolean = js.native
164150

165151
}
166152

@@ -237,10 +223,7 @@ object Writable {
237223
def endAsync(): Promise[Unit] = promiseWithError0[Error](writable.end)
238224

239225
@inline
240-
def writeAsync(chunk: Buffer): Promise[Unit] = promiseWithError0[Error](writable.write(chunk, _))
241-
242-
@inline
243-
def writeAsync(chunk: String, encoding: String = null): Promise[Unit] = {
226+
def writeAsync(chunk: Buffer | String, encoding: String = null): Promise[Unit] = {
244227
promiseWithError0[Error](writable.write(chunk, encoding, _))
245228
}
246229

@@ -254,5 +237,6 @@ object Writable {
254237
* @param encoding the data's optional encoding
255238
*/
256239
@ScalaJSDefined
257-
class Chunk(val chunk: Buffer | String, val encoding: js.UndefOr[String] = js.undefined)
240+
class Chunk(val chunk: Buffer | String,
241+
val encoding: js.UndefOr[String] = js.undefined)
258242
extends js.Object

src/test/resources/watchfile.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "scalajs-io",
3-
"version": "0.4.0-pre2",
3+
"version": "0.4.0-pre3",
44
"private": true,
55
"dependencies": {
66
"async": "^2.0.1",

0 commit comments

Comments
 (0)