Skip to content

Commit 8a9f344

Browse files
committed
Continued development
1. Added the NodeJS url module 2. Added the NodeJS zlib module 3. Improved facade coverage of the NodeJS fs module 4. Improved facade coverage of the NodeJS util module 5. Fixed issue with MongoDB findOneAsync method 6. Converted *Options traits into classes
1 parent 7a3ad5a commit 8a9f344

File tree

79 files changed

+1885
-559
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1885
-559
lines changed

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ modules implemented for most web applications.
6161
<a name="NodeJS_Modules">
6262
#### Modules
6363

64-
The following modules have been implemented thus far:
64+
The following NodeJS modules have been implemented thus far:
6565

6666
* body-parser
6767
* buffer
@@ -70,11 +70,16 @@ The following modules have been implemented thus far:
7070
* express-ws
7171
* fs
7272
* http
73+
* https
7374
* kafka-node
7475
* mongodb
7576
* net
77+
* os
7678
* node-zookeeper-client
79+
* readline
80+
* repl
7781
* stream
82+
* url
7883
* util
7984

8085
I've provided an example to demonstrate how similar the Scala.js code is to the JavaScript

angularjs/src/main/scala/com/github/ldaniels528/meansjs/angularjs/extensions/FileUpload.scala

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package com.github.ldaniels528.meansjs.angularjs.extensions
22

33
import com.github.ldaniels528.meansjs.angularjs.core.HttpPromise
4-
import com.github.ldaniels528.meansjs.util.ScalaJsHelper._
54
import org.scalajs.dom._
65

76
import scala.scalajs.js
7+
import scala.scalajs.js.annotation.ScalaJSDefined
88

99
/**
1010
* AngularJS File Upload
@@ -21,14 +21,14 @@ trait FileUpload extends js.Object {
2121
* File Upload Configuration
2222
2323
*/
24-
@js.native
25-
trait FileUploadConfig extends js.Object {
26-
var data: Any = js.native
27-
var file: File = js.native
28-
var fileName: js.Any = js.native
29-
var fileFormDataName: js.Any = js.native
30-
var method: String = js.native
31-
var url: String = js.native
24+
@ScalaJSDefined
25+
class FileUploadConfig extends js.Object {
26+
var data: Any = _
27+
var file: File = _
28+
var fileName: js.Any = _
29+
var fileFormDataName: js.Any = _
30+
var method: String = _
31+
var url: String = _
3232

3333
}
3434

@@ -42,7 +42,7 @@ object FileUploadConfig {
4242
require(url != null || url.isEmpty, "Required property 'url' is missing")
4343
require(file != null, "Required property 'file' is missing")
4444

45-
val config = makeNew[FileUploadConfig]
45+
val config = new FileUploadConfig()
4646
config.url = url
4747
config.file = file
4848
config.data = data

angularjs/src/main/scala/com/github/ldaniels528/meansjs/angularjs/extensions/nervgh/FileUploader.scala

+9-8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import com.github.ldaniels528.meansjs.util.ScalaJsHelper._
44
import org.scalajs.dom.Element
55

66
import scala.scalajs.js
7+
import scala.scalajs.js.annotation.ScalaJSDefined
78

89
/**
910
* Angular File Uploader (nervgh/angular-js-upload)
@@ -31,7 +32,7 @@ trait FileUploader extends js.Object {
3132
* Filters to be applied to the files before adding them to the queue.
3233
* If the filter returns true the file will be added to the queue
3334
*/
34-
var filters: js.Array[FileFilter] = js.native
35+
var filters: js.Array[FileUploadFilter] = js.native
3536

3637
/**
3738
* Data to be sent along with the files
@@ -201,7 +202,7 @@ trait FileUploader extends js.Object {
201202
// Event Functions
202203
///////////////////////////////////////////////////////////////////////////
203204

204-
var onWhenAddingFileFailed: js.Function3[FileItem, FileFilter, FileItem, Unit] = js.native //(item /*{File|FileLikeObject}*/, filter, options)
205+
var onWhenAddingFileFailed: js.Function3[FileItem, FileUploadFilter, FileItem, Unit] = js.native //(item /*{File|FileLikeObject}*/, filter, options)
205206

206207
var onAfterAddingFile: js.Function1[FileItem, Unit] = js.native //(fileItem)
207208

@@ -239,16 +240,16 @@ object FileUploader {
239240
* File Upload Filter
240241
241242
*/
242-
@js.native
243-
trait FileFilter extends js.Object {
244-
var name: String = js.native
245-
var fn: js.Function = js.native
243+
@ScalaJSDefined
244+
class FileUploadFilter extends js.Object {
245+
var name: String = _
246+
var fn: js.Function = _
246247
}
247248

248-
object FileFilter {
249+
object FileUploadFilter {
249250

250251
def apply(name: String, fn: js.Function) = {
251-
val filter = makeNew[FileFilter]
252+
val filter = new FileUploadFilter()
252253
filter.name = name
253254
filter.fn = fn
254255
filter

angularjs/src/main/scala/com/github/ldaniels528/meansjs/angularjs/extensions/nervgh/FileUploaderConfig.scala

+7-6
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ package com.github.ldaniels528.meansjs.angularjs.extensions.nervgh
33
import com.github.ldaniels528.meansjs.util.ScalaJsHelper._
44

55
import scala.scalajs.js
6+
import scala.scalajs.js.annotation.ScalaJSDefined
67

78
/**
89
* File Uploader Config
910
1011
*/
11-
@js.native
12-
trait FileUploaderConfig extends js.Object {
13-
var url: String = js.native
14-
var filters: js.Array[FileFilter] = js.native
12+
@ScalaJSDefined
13+
class FileUploaderConfig extends js.Object {
14+
var url: String = _
15+
var filters: js.Array[FileUploadFilter] = _
1516
}
1617

1718
/**
@@ -20,8 +21,8 @@ trait FileUploaderConfig extends js.Object {
2021
*/
2122
object FileUploaderConfig {
2223

23-
def apply(url: String, filters: js.Array[FileFilter] = emptyArray) = {
24-
val config = makeNew[FileUploaderConfig]
24+
def apply(url: String, filters: js.Array[FileUploadFilter] = emptyArray) = {
25+
val config = new FileUploaderConfig()
2526
config.url = url
2627
config.filters = filters
2728
config

build.sbt

+45-33
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import sbt.Keys._
44
import sbt.Project.projectToRef
55
import sbt._
66

7-
val apiVersion = "0.0.9"
7+
val apiVersion = "0.1.0"
88
val paradisePluginVersion = "2.1.0"
99
val _scalaVersion = "2.11.8"
1010
val scalaJsDomVersion = "0.9.0"
@@ -25,7 +25,10 @@ val commonSettings = Seq(
2525
)
2626

2727
lazy val root = (project in file(".")).
28-
aggregate(core, angularjs, express, facebook, kafka_node, linkedin, mongodb, node, node_os, node_zookeeper, repl)
28+
aggregate(
29+
core, angularjs, facebook, linkedin,
30+
node_core, node_express, node_kafka, node_mongodb, node_os, node_repl, node_zlib, node_zookeeper
31+
)
2932

3033
lazy val core = (project in file("core")).
3134
enablePlugins(ScalaJSPlugin).
@@ -53,89 +56,98 @@ lazy val facebook = (project in file("social/facebook")).
5356
description := "Social/Facebook facade for Scala.js"
5457
)
5558

56-
lazy val express = (project in file("node/express")).
57-
dependsOn(core, node).
59+
lazy val linkedin = (project in file("social/linkedin")).
60+
dependsOn(core, angularjs).
5861
enablePlugins(ScalaJSPlugin).
5962
settings(commonSettings: _*).
6063
settings(
61-
name := "means-node-express",
62-
description := "NodeJS/Express facade for Scala.js"
64+
name := "means-social-linkedin",
65+
description := "Social/LinkedIn facade for Scala.js"
6366
)
6467

65-
lazy val linkedin = (project in file("social/linkedin")).
66-
dependsOn(core, angularjs).
68+
lazy val node_core = (project in file("node/core")).
69+
dependsOn(core).
6770
enablePlugins(ScalaJSPlugin).
6871
settings(commonSettings: _*).
6972
settings(
70-
name := "means-social-linkedin",
71-
description := "Social/LinkedIn facade for Scala.js"
73+
name := "means-node-core",
74+
description := "NodeJS/Core facade for Scala.js"
75+
)
76+
77+
lazy val node_express = (project in file("node/express")).
78+
dependsOn(core, node_core).
79+
enablePlugins(ScalaJSPlugin).
80+
settings(commonSettings: _*).
81+
settings(
82+
name := "means-node-express",
83+
description := "NodeJS/Express facade for Scala.js"
7284
)
7385

74-
lazy val kafka_node = (project in file("node/kafka_node")).
75-
dependsOn(core, node, node_zookeeper).
86+
lazy val node_kafka = (project in file("node/kafka_node")).
87+
dependsOn(core, node_core, node_zookeeper).
7688
enablePlugins(ScalaJSPlugin).
7789
settings(commonSettings: _*).
7890
settings(
7991
name := "means-node-kafkanode",
8092
description := "NodeJS/Kafka facade for Scala.js"
8193
)
8294

83-
lazy val mongodb = (project in file("node/mongodb")).
84-
dependsOn(core, node).
95+
lazy val node_mongodb = (project in file("node/mongodb")).
96+
dependsOn(core, node_core).
8597
enablePlugins(ScalaJSPlugin).
8698
settings(commonSettings: _*).
8799
settings(
88100
name := "means-node-mongodb",
89101
description := "NodeJS/MongoDB facade for Scala.js"
90102
)
91103

92-
lazy val node = (project in file("node/core")).
93-
dependsOn(core).
104+
lazy val node_os = (project in file("node/os")).
105+
dependsOn(core, node_core).
94106
enablePlugins(ScalaJSPlugin).
95107
settings(commonSettings: _*).
96108
settings(
97-
name := "means-node-core",
98-
description := "NodeJS/Core facade for Scala.js"
109+
name := "means-node-os",
110+
description := "NodeJS/OS facade for Scala.js"
99111
)
100112

101-
lazy val node_os = (project in file("node/os")).
102-
dependsOn(core, node).
113+
lazy val node_repl = (project in file("node/repl")).
114+
dependsOn(core, node_core).
103115
enablePlugins(ScalaJSPlugin).
104116
settings(commonSettings: _*).
105117
settings(
106-
name := "means-node-os",
107-
description := "NodeJS/OS facade for Scala.js"
118+
name := "means-node-repl",
119+
description := "NodeJS/REPL facade for Scala.js"
108120
)
109121

110-
lazy val node_zookeeper = (project in file("node/node_zookeeper")).
111-
dependsOn(core, node).
122+
lazy val node_zlib = (project in file("node/zlib")).
123+
dependsOn(core, node_core).
112124
enablePlugins(ScalaJSPlugin).
113125
settings(commonSettings: _*).
114126
settings(
115-
name := "means-node-zookeeper-client",
116-
description := "NodeJS/Zookeeper-client facade for Scala.js"
127+
name := "means-node-zlib",
128+
description := "NodeJS/Zlib facade for Scala.js"
117129
)
118130

119-
lazy val repl = (project in file("node/repl")).
120-
dependsOn(core, node).
131+
lazy val node_zookeeper = (project in file("node/node_zookeeper")).
132+
dependsOn(core, node_core).
121133
enablePlugins(ScalaJSPlugin).
122134
settings(commonSettings: _*).
123135
settings(
124-
name := "means-node-repl",
125-
description := "NodeJS/REPL facade for Scala.js"
136+
name := "means-node-zookeeper-client",
137+
description := "NodeJS/Zookeeper-client facade for Scala.js"
126138
)
127139

128140
lazy val examples = (project in file("examples")).
129-
aggregate(core, express, kafka_node, mongodb, node, node_os, node_zookeeper, repl).
130-
dependsOn(core, express, kafka_node, mongodb, node, node_os, node_zookeeper, repl).
141+
aggregate(core, node_core, node_express, node_kafka, node_mongodb, node_os, node_repl, node_zlib, node_zookeeper).
142+
dependsOn(core, node_core, node_express, node_kafka, node_mongodb, node_os, node_repl, node_zlib, node_zookeeper).
131143
enablePlugins(ScalaJSPlugin).
132144
settings(commonSettings: _*).
133145
settings(
134146
name := "means-examples",
135147
description := "MEANS.js examples",
136148
pipelineStages := Seq(gzip),
137149
compile in Compile <<=
138-
(compile in Compile) dependsOn (fastOptJS in(node, Compile)),
150+
(compile in Compile) dependsOn (fastOptJS in(node_core, Compile)),
139151
ivyScala := ivyScala.value map (_.copy(overrideScalaVersion = true))
140152
)
141153

0 commit comments

Comments
 (0)