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

Commit 5cb395f

Browse files
authored
Merge pull request #270 from exoego/vm
[vm] SecureContext is renamed to Context and now just an alias of js.Object
2 parents b22d2ee + 7785d3c commit 5cb395f

File tree

6 files changed

+35
-19
lines changed

6 files changed

+35
-19
lines changed

app/nodejs-v14/src/main/scala/io/scalajs/nodejs/vm/Script.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ class Script private[this] () extends js.Object {
2626
* @param options the optional options
2727
* @example script.runInContext(contextifiedSandbox[, options])
2828
*/
29-
def runInContext(contextifiedSandbox: ScriptContext, options: RunInContextOptions): js.Any = js.native
30-
def runInContext(contextifiedSandbox: ScriptContext): js.Any = js.native
29+
def runInContext(contextifiedSandbox: Context, options: RunInContextOptions): js.Any = js.native
30+
def runInContext(contextifiedSandbox: Context): js.Any = js.native
3131

3232
/**
3333
* First contextifies the given sandbox, runs the compiled code contained by the vm.Script object within the created

app/nodejs-v14/src/main/scala/io/scalajs/nodejs/vm/ScriptContext.scala

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package io.scalajs.nodejs.vm
2+
3+
import net.exoego.scalajs.types.util.Factory
4+
5+
import scala.scalajs.js
6+
7+
class SyntheticModule protected () extends js.Object {
8+
def this(exportNames: js.Array[String], evaluateCallback: js.Function, options: SyntheticModuleOptions) = this()
9+
def this(exportNames: js.Array[String], evaluateCallback: js.Function) = this()
10+
11+
}
12+
13+
@Factory
14+
trait SyntheticModuleOptions extends js.Object {
15+
var identifier: js.UndefOr[String] = js.undefined
16+
var context: js.UndefOr[Context] = js.undefined
17+
}

app/nodejs-v14/src/main/scala/io/scalajs/nodejs/vm/VM.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ trait VM extends js.Object {
3333
* @example vm.createContext([sandbox])
3434
* @since 0.11.7
3535
*/
36-
def createContext(sandbox: js.Object, options: CreateContextOptions): ScriptContext = js.native
37-
def createContext(sandbox: js.Object): ScriptContext = js.native
38-
def createContext(): ScriptContext = js.native
36+
def createContext(sandbox: js.Object, options: CreateContextOptions): Context = js.native
37+
def createContext(sandbox: js.Object): Context = js.native
38+
def createContext(): Context = js.native
3939

4040
/**
4141
* Returns true if the given sandbox object has been contextified using vm.createContext().
@@ -52,8 +52,8 @@ trait VM extends js.Object {
5252
* @param options the optional options
5353
* @example script.runInContext(contextifiedSandbox[, options])
5454
*/
55-
def runInContext(code: String, contextifiedSandbox: ScriptContext, options: VMRunInContextOptions): js.Any = js.native
56-
def runInContext(code: String, contextifiedSandbox: ScriptContext): js.Any = js.native
55+
def runInContext(code: String, contextifiedSandbox: Context, options: VMRunInContextOptions): js.Any = js.native
56+
def runInContext(code: String, contextifiedSandbox: Context): js.Any = js.native
5757

5858
/**
5959
* First contextifies the given sandbox, runs the compiled code contained by the vm.Script object within the created
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package io.scalajs.nodejs
2+
3+
import scala.scalajs.js
4+
5+
package object vm {
6+
type Context = js.Object
7+
@deprecated("Use js.Object instead", "v0.12.0")
8+
type ScriptContext = js.Object
9+
}

app/nodejs-v14/src/main/scala/io/scalajs/nodejs/worker_threads/WorkerThreads.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ trait WorkerThreads extends js.Object {
1818
def workerData: js.Any = js.native
1919

2020
@enableIf(io.scalajs.nodejs.internal.CompilerSwitches.gteNodeJs12)
21-
def moveMessagePortToContext(port: MessagePort,
22-
contextifiedSandbox: io.scalajs.nodejs.vm.ScriptContext
23-
): MessagePort = js.native
21+
def moveMessagePortToContext(port: MessagePort, contextifiedSandbox: io.scalajs.nodejs.vm.Context): MessagePort =
22+
js.native
2423

2524
@enableIf(io.scalajs.nodejs.internal.CompilerSwitches.gteNodeJs12)
2625
def receiveMessageOnPort(port: MessagePort): js.UndefOr[js.Object] = js.native

0 commit comments

Comments
 (0)