Skip to content
This repository was archived by the owner on Jul 30, 2024. It is now read-only.

Commit 8922f52

Browse files
committed
Node.js v16
1 parent 0cae3af commit 8922f52

File tree

109 files changed

+3784
-2722
lines changed

Some content is hidden

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

109 files changed

+3784
-2722
lines changed

app/nodejs-v16/src/main/scala/io/scalajs/nodejs/Assert.scala

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,28 @@ import scala.scalajs.js
44
import scala.scalajs.js.annotation.JSImport
55

66
/** The assert module provides a simple set of assertion tests that can be used to test invariants. The module is
7-
* intended for internal use by Node.js, but can be used in application code via require('assert'). However, assert
8-
* is not a testing framework, and is not intended to be used as a general purpose assertion library.
7+
* intended for internal use by Node.js, but can be used in application code via require('assert'). However, assert is
8+
* not a testing framework, and is not intended to be used as a general purpose assertion library.
99
*
10-
* The API for the assert module is Locked. This means that there will be no additions or changes to any of the
11-
* methods implemented and exposed by the module.
10+
* The API for the assert module is Locked. This means that there will be no additions or changes to any of the methods
11+
* implemented and exposed by the module.
1212
*/
1313
@js.native
1414
trait Assert extends js.Object {
1515

1616
/** An alias of assert.ok() .
17-
* @param expression the expression to evaluate
18-
* @example assert(value[, message])
17+
* @param expression
18+
* the expression to evaluate
19+
* @example
20+
* assert(value[, message])
1921
*/
2022
def apply(expression: js.Any, message: String): Unit = js.native
2123
def apply(expression: js.Any): Unit = js.native
2224

2325
/** Generally identical to assert.deepEqual() with two exceptions. First, primitive values are compared using the
2426
* strict equality operator ( === ). Second, object comparisons include a strict equality check of their prototypes.
25-
* @example assert.deepStrictEqual(actual, expected[, message])
27+
* @example
28+
* assert.deepStrictEqual(actual, expected[, message])
2629
*/
2730
def deepStrictEqual(actual: js.Any, expected: js.Any, message: String): Unit = js.native
2831
def deepStrictEqual(actual: js.Any, expected: js.Any): Unit = js.native
@@ -40,11 +43,12 @@ trait Assert extends js.Object {
4043
def doesNotReject(asyncFn: js.Promise[_], message: String): Unit = js.native
4144
def doesNotReject(asyncFn: js.Promise[_]): Unit = js.native
4245

43-
/** Asserts that the function block does not throw an error. See assert.throws() for more details.
44-
* When assert.doesNotThrow() is called, it will immediately call the block function. If an error is thrown
45-
* and it is the same type as that specified by the error parameter, then an AssertionError is thrown. If the
46-
* error is of a different type, or if the error parameter is undefined, the error is propagated back to the caller.
47-
* @example assert.doesNotThrow(block[, error][, message])
46+
/** Asserts that the function block does not throw an error. See assert.throws() for more details. When
47+
* assert.doesNotThrow() is called, it will immediately call the block function. If an error is thrown and it is the
48+
* same type as that specified by the error parameter, then an AssertionError is thrown. If the error is of a
49+
* different type, or if the error parameter is undefined, the error is propagated back to the caller.
50+
* @example
51+
* assert.doesNotThrow(block[, error][, message])
4852
*/
4953
def doesNotThrow(block: js.Function, error: js.RegExp, message: String): Unit = js.native
5054
def doesNotThrow(block: js.Function, error: js.RegExp): Unit = js.native
@@ -53,50 +57,57 @@ trait Assert extends js.Object {
5357
def doesNotThrow(block: js.Function, message: String): Unit = js.native
5458
def doesNotThrow(block: js.Function): Unit = js.native
5559

56-
/** @see https://nodejs.org/api/assert.html#assert_assert_fail_message
60+
/** @see
61+
* https://nodejs.org/api/assert.html#assert_assert_fail_message
5762
*/
5863
def fail(message: String): Unit = js.native
5964

60-
/** @see https://nodejs.org/api/assert.html#assert_assert_fail_message
65+
/** @see
66+
* https://nodejs.org/api/assert.html#assert_assert_fail_message
6167
*/
6268
def fail(message: js.Error): Unit = js.native
6369

6470
@deprecated("Use assert.fail([message]) or other assert functions instead.", "Node.js v10.0.0")
6571
def fail(actual: js.Any, expected: js.Any, message: String, operator: String): Unit = js.native
6672

6773
/** Throws value if value is truthy. This is useful when testing the error argument in callbacks.
68-
* @example assert.ifError(value)
74+
* @example
75+
* assert.ifError(value)
6976
*/
7077
def ifError(value: js.Any): Unit = js.native
7178

7279
/** Tests for deep strict inequality. Opposite of assert.deepStrictEqual().
73-
* @example assert.notDeepStrictEqual(actual, expected[, message])
80+
* @example
81+
* assert.notDeepStrictEqual(actual, expected[, message])
7482
*/
7583
def notDeepStrictEqual(actual: js.Any, expected: js.Any, message: String): Unit = js.native
7684
def notDeepStrictEqual(actual: js.Any, expected: js.Any): Unit = js.native
7785

7886
/** Tests strict inequality as determined by the strict not equal operator ( !== ).
79-
* @example assert.notStrictEqual(actual, expected[, message])
87+
* @example
88+
* assert.notStrictEqual(actual, expected[, message])
8089
*/
8190
def notStrictEqual(actual: js.Any, expected: js.Any, message: String): Unit = js.native
8291
def notStrictEqual(actual: js.Any, expected: js.Any): Unit = js.native
8392

84-
/** Tests if value is truthy. It is equivalent to assert.equal(!!value, true, message). If value is not truthy,
85-
* an AssertionError is thrown with a message property set equal to the value of the message parameter. If the
86-
* message parameter is undefined, a default error message is assigned.
93+
/** Tests if value is truthy. It is equivalent to assert.equal(!!value, true, message). If value is not truthy, an
94+
* AssertionError is thrown with a message property set equal to the value of the message parameter. If the message
95+
* parameter is undefined, a default error message is assigned.
8796
*/
8897
def ok(value: js.Any, message: String): Unit = js.native
8998
def ok(value: js.Any): Unit = js.native
9099

91100
/** Tests strict equality as determined by the strict equality operator ( === ).
92-
* @example assert.strictEqual(actual, expected[, message])
101+
* @example
102+
* assert.strictEqual(actual, expected[, message])
93103
*/
94104
def strictEqual(actual: js.Any, expected: js.Any, message: String): Unit = js.native
95105
def strictEqual(actual: js.Any, expected: js.Any): Unit = js.native
96106

97107
/** If the values are not strictly equal, an AssertionError is thrown with a message property set equal to the value
98108
* of the message parameter. If the message parameter is undefined, a default error message is assigned.
99-
* @example assert.throws(block[, error][, message])
109+
* @example
110+
* assert.throws(block[, error][, message])
100111
*/
101112
def throws(block: js.Function, error: js.Object, message: String): Unit = js.native
102113
def throws(block: js.Function, error: js.Object): Unit = js.native

app/nodejs-v16/src/main/scala/io/scalajs/nodejs/Error.scala

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,27 @@ import com.thoughtworks.enableIf
55
import scala.scalajs.js
66
import scala.scalajs.js.annotation.JSGlobal
77

8-
/** Creates a new Error object and sets the error.message property to the provided text message.
9-
* If an object is passed as message, the text message is generated by calling message.toString().
10-
* The error.stack property will represent the point in the code at which new Error() was called.
11-
* Stack traces are dependent on V8's stack trace API. Stack traces extend only to either (a) the
12-
* beginning of synchronous code execution, or (b) the number of frames given by the property
13-
* Error.stackTraceLimit, whichever is smaller.
8+
/** Creates a new Error object and sets the error.message property to the provided text message. If an object is passed
9+
* as message, the text message is generated by calling message.toString(). The error.stack property will represent the
10+
* point in the code at which new Error() was called. Stack traces are dependent on V8's stack trace API. Stack traces
11+
* extend only to either (a) the beginning of synchronous code execution, or (b) the number of frames given by the
12+
* property Error.stackTraceLimit, whichever is smaller.
1413
*/
1514
@js.native
1615
@JSGlobal
1716
class Error() extends js.Object {
1817
def this(message0: String) = this()
1918

20-
/** The `error.code` property is a string label that identifies the kind of error.
21-
* `error.code` is the most stable way to identify an error.
22-
* It will only change between major versions of Node.js.
23-
* In contrast, error.message strings may change between any versions of Node.js
24-
* See Node.js Error Codes for details about specific codes.
19+
/** The `error.code` property is a string label that identifies the kind of error. `error.code` is the most stable way
20+
* to identify an error. It will only change between major versions of Node.js. In contrast, error.message strings
21+
* may change between any versions of Node.js See Node.js Error Codes for details about specific codes.
2522
*/
2623
val code: String = js.native
2724

28-
/** The error.message property is the string description of the error as set by calling new Error(message).
29-
* The message passed to the constructor will also appear in the first line of the stack trace of the Error,
30-
* however changing this property after the Error object is created may not change the first line of the
31-
* stack trace (for example, when error.stack is read before this property is changed).
25+
/** The error.message property is the string description of the error as set by calling new Error(message). The
26+
* message passed to the constructor will also appear in the first line of the stack trace of the Error, however
27+
* changing this property after the Error object is created may not change the first line of the stack trace (for
28+
* example, when error.stack is read before this property is changed).
3229
*/
3330
val message: String = js.native
3431

@@ -56,13 +53,15 @@ object Error extends js.Object {
5653

5754
/** Creates a .stack property on targetObject, which when accessed returns a string representing the location in the
5855
* code at which Error.captureStackTrace() was called.
59-
* @param targetObject The first line of the trace, instead of being prefixed with ErrorType: message, will be the
60-
* result of calling targetObject.toString().
61-
* @param constructorOpt The optional constructorOpt argument accepts a function. If given, all frames above
62-
* constructorOpt, including constructorOpt, will be omitted from the generated stack trace.
63-
* The constructorOpt argument is useful for hiding implementation details of error generation
64-
* from an end user.
65-
* @example Error.captureStackTrace(targetObject[, constructorOpt])
56+
* @param targetObject
57+
* The first line of the trace, instead of being prefixed with ErrorType: message, will be the result of calling
58+
* targetObject.toString().
59+
* @param constructorOpt
60+
* The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including
61+
* constructorOpt, will be omitted from the generated stack trace. The constructorOpt argument is useful for hiding
62+
* implementation details of error generation from an end user.
63+
* @example
64+
* Error.captureStackTrace(targetObject[, constructorOpt])
6665
*/
6766
def captureStackTrace(targetObject: js.Any, constructorOpt: js.Any): Unit = js.native
6867
def captureStackTrace(targetObject: js.Any): Unit = js.native

app/nodejs-v16/src/main/scala/io/scalajs/nodejs/Module.scala

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,59 @@ package io.scalajs.nodejs
22

33
import scala.scalajs.js
44

5-
/** In each module, the module free variable is a reference to the object representing the current module.
6-
* For convenience, module.exports is also accessible via the exports module-global. module isn't actually
7-
* a global but rather local to each module.
8-
* @see [[https://nodejs.org/api/modules.html#modules_the_module_object]]
5+
/** In each module, the module free variable is a reference to the object representing the current module. For
6+
* convenience, module.exports is also accessible via the exports module-global. module isn't actually a global but
7+
* rather local to each module.
8+
* @see
9+
* [[https://nodejs.org/api/modules.html#modules_the_module_object]]
910
*/
1011
@js.native
1112
trait Module extends js.Object {
1213

1314
/** The module objects required by this one.
14-
* @example module.children
15+
* @example
16+
* module.children
1517
*/
1618
var children: js.Array[Module] = js.native
1719

18-
/** The module.exports object is created by the Module system. Sometimes this is not acceptable;
19-
* many want their module to be an instance of some class. To do this, assign the desired export
20-
* object to module.exports. Note that assigning the desired object to exports will simply rebind
21-
* the local exports variable, which is probably not what you want to do.
22-
* @example module.exports
20+
/** The module.exports object is created by the Module system. Sometimes this is not acceptable; many want their
21+
* module to be an instance of some class. To do this, assign the desired export object to module.exports. Note that
22+
* assigning the desired object to exports will simply rebind the local exports variable, which is probably not what
23+
* you want to do.
24+
* @example
25+
* module.exports
2326
*/
2427
var exports: js.Object = js.native
2528

2629
/** The fully resolved filename to the module.
27-
* @example module.filename
30+
* @example
31+
* module.filename
2832
*/
2933
var filename: String = js.native
3034

3135
/** The identifier for the module. Typically this is the fully resolved filename.
32-
* @example module.id
36+
* @example
37+
* module.id
3338
*/
3439
var id: String = js.native
3540

3641
/** Whether or not the module is done loading, or is in the process of loading.
37-
* @example module.loaded
42+
* @example
43+
* module.loaded
3844
*/
3945
var loaded: Boolean = js.native
4046

4147
/** The module that first required this one.
42-
* @example module.parent
48+
* @example
49+
* module.parent
4350
*/
4451
var parent: js.Any = js.native
4552

4653
var paths: js.Array[String] = js.native
4754

4855
/** The module.require method provides a way to load a module as if require() was called from the original module.
49-
* <p/><b>Note</b> that in order to do this, you must get a reference to the module object. Since require() returns the
50-
* module.exports, and the module is typically only available within a specific module's code, it must be
56+
* <p/><b>Note</b> that in order to do this, you must get a reference to the module object. Since require() returns
57+
* the module.exports, and the module is typically only available within a specific module's code, it must be
5158
* explicitly exported in order to be used.
5259
*/
5360
def require[T <: js.Any](id: String): T = js.native

app/nodejs-v16/src/main/scala/io/scalajs/nodejs/StringDecoder.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ class StringDecoder() extends IEventEmitter {
1515
def this(encoding: String) = this()
1616

1717
/** Returns any trailing bytes that were left in the buffer.
18-
* @example decoder.end()
18+
* @example
19+
* decoder.end()
1920
*/
2021
def end(buffer: TypedArray[_, _]): String = js.native
2122
def end(buffer: DataView): String = js.native
2223
def end(): String = js.native
2324

2425
/** Returns a decoded string.
25-
* @example decoder.write(buffer)
26+
* @example
27+
* decoder.write(buffer)
2628
*/
2729
def write(buffer: TypedArray[_, _]): String = js.native
2830
def write(buffer: DataView): String = js.native

app/nodejs-v16/src/main/scala/io/scalajs/nodejs/SystemError.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,28 @@ import scala.scalajs.js.|
88
@js.native
99
trait SystemError extends Error {
1010

11-
/** The error.errno property is a number or a string. The number is a negative value which corresponds
12-
* to the error code defined in libuv Error handling. See uv-errno.h header file (deps/uv/include/uv-errno.h
13-
* in the Node.js source tree) for details. In case of a string, it is the same as error.code.
11+
/** The error.errno property is a number or a string. The number is a negative value which corresponds to the error
12+
* code defined in libuv Error handling. See uv-errno.h header file (deps/uv/include/uv-errno.h in the Node.js source
13+
* tree) for details. In case of a string, it is the same as error.code.
1414
*/
1515
val errno: String | Int = js.native
1616

1717
/** The error.syscall property is a string describing the syscall that failed.
1818
*/
1919
val syscall: String = js.native
2020

21-
/** When present (e.g. in fs or child_process), the error.path property is a string containing
22-
* a relevant invalid pathname.
21+
/** When present (e.g. in fs or child_process), the error.path property is a string containing a relevant invalid
22+
* pathname.
2323
*/
2424
val path: String = js.native
2525

26-
/** When present (e.g. in net or dgram), the error.address property is a string describing the address
27-
* to which the connection failed.
26+
/** When present (e.g. in net or dgram), the error.address property is a string describing the address to which the
27+
* connection failed.
2828
*/
2929
val address: String = js.native
3030

31-
/** When present (e.g. in net or dgram), the error.port property is a number representing the connection's
32-
* port that is not available.
31+
/** When present (e.g. in net or dgram), the error.port property is a number representing the connection's port that
32+
* is not available.
3333
*/
3434
val port: Int = js.native
3535

0 commit comments

Comments
 (0)