java-bridge 2.3.0-beta.5 → 2.3.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -56,8 +56,9 @@ npm run build
56
56
  | macOS | - | ✅ | - | ✅ |
57
57
 
58
58
  Supported linux distros
59
- * Ubuntu `>= 20.04`
60
- * Debian `>= bullseye`
59
+
60
+ - Ubuntu `>= 20.04`
61
+ - Debian `>= bullseye`
61
62
 
62
63
  ## Usage
63
64
 
package/native.d.ts ADDED
@@ -0,0 +1,93 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /* auto-generated by NAPI-RS */
5
+
6
+ /** Options for the interface proxies */
7
+ export interface InterfaceProxyOptions {
8
+ /**
9
+ * If true, the proxy will be kept as a daemon
10
+ * proxy after the interface has been destroyed
11
+ */
12
+ keepAsDaemon?: boolean
13
+ }
14
+ /** Clears the list of daemon proxies. */
15
+ export function clearDaemonProxies(): void
16
+ /**
17
+ * Options for the Java VM.
18
+ * Not the same as vm arguments.
19
+ */
20
+ export interface JavaOptions {
21
+ /**
22
+ * Additional items to add to the class path. This does allow for wildcard imports
23
+ * using glob patterns. If a path is unreadable, an error will be thrown.
24
+ * This behaviour can be changed by setting `ignore_unreadable_class_path_entries` to true.
25
+ */
26
+ classpath?: Array<string>
27
+ /** Whether to ignore unreadable class path entries */
28
+ ignoreUnreadableClassPathEntries?: boolean
29
+ }
30
+ /**
31
+ * Get the path to the jvm.(dll|so|dylib) file.
32
+ * Throws an error if the library could not be found.
33
+ */
34
+ export function getJavaLibPath(): string
35
+ export class JavaInterfaceProxy {
36
+ get proxy(): object | null
37
+ reset(force?: boolean | undefined | null): void
38
+ }
39
+ /**
40
+ * The main java class.
41
+ * This should only be created once per process.
42
+ * Any other attempts to create a new jvm instance will fail.
43
+ */
44
+ export class Java {
45
+ /**
46
+ * Create a new JVM instance.
47
+ * @param libPath The path to jvm.(dll|so|dylib)
48
+ * @param version The JVM version to use.
49
+ * @param opts The JVM options to use.
50
+ */
51
+ constructor(libPath: string | undefined | null, version: string | undefined | null, opts: Array<string> | undefined | null, javaOptions: JavaOptions | undefined | null, javaLibPath: string, nativeLibPath: string)
52
+ /**
53
+ * Import a java class
54
+ * Will import the class and parse all of its methods and fields.
55
+ * The imported class will be cached for future use.
56
+ */
57
+ importClass(className: string): object
58
+ /**
59
+ * Import a java class (async)
60
+ * Will return a promise that resolves to the class instance.
61
+ * @see importClass
62
+ */
63
+ importClassAsync(className: string): Promise<object>
64
+ /**
65
+ * Get the wanted JVM version.
66
+ * This may not match the actual JVM version.
67
+ */
68
+ get wantedVersion(): string
69
+ /**
70
+ * Get the actual JVM version.
71
+ * This may not match the wanted JVM version.
72
+ */
73
+ get version(): string
74
+ /** Get the loaded jars. */
75
+ get loadedJars(): Array<string>
76
+ /** Append a single or multiple jars to the classpath. */
77
+ appendClasspath(classpath: string | string[]): void
78
+ /** Set the stdout/stderr callbacks */
79
+ setStdoutCallbacks(stdoutCallback?: ((err: Error | null, data?: string) => void) | undefined | null, stderrCallback?: ((err: Error | null, data?: string) => void) | undefined | null): StdoutRedirect
80
+ createInterfaceProxy(classname: string, methods: Record<string, (err: null | Error, callback: (err: Error | null, data?: any | null) => void, ...args: any[]) => void>, options?: InterfaceProxyOptions | undefined | null): JavaInterfaceProxy
81
+ /** Check if `this` is instance of `other` */
82
+ isInstanceOf(thisObj: object, other: string | object): boolean
83
+ get classLoader(): object
84
+ set classLoader(classLoader: object)
85
+ }
86
+ export class JavaConfig {
87
+ static setRunEventLoopWhenInterfaceProxyIsActive(value: boolean): void
88
+ static getRunEventLoopWhenInterfaceProxyIsActive(): boolean
89
+ }
90
+ export class StdoutRedirect {
91
+ on(event: string, callback?: ((...args: any[]) => any) | null): void
92
+ reset(): void
93
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "java-bridge",
3
- "version": "2.3.0-beta.5",
3
+ "version": "2.3.0-beta.7",
4
4
  "main": "dist/index.prod.min.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "A bridge between Node.js and Java APIs",
@@ -17,7 +17,8 @@
17
17
  "dist/*.js",
18
18
  "dist/*.map",
19
19
  "dist/**/*.d.ts",
20
- "java-src/build/libs/*.jar"
20
+ "java-src/build/libs/*.jar",
21
+ "native.d.ts"
21
22
  ],
22
23
  "napi": {
23
24
  "name": "java",
@@ -105,11 +106,11 @@
105
106
  "which": "^3.0.0"
106
107
  },
107
108
  "optionalDependencies": {
108
- "java-bridge-win32-x64-msvc": "2.3.0-beta.5",
109
- "java-bridge-darwin-x64": "2.3.0-beta.5",
110
- "java-bridge-linux-x64-gnu": "2.3.0-beta.5",
111
- "java-bridge-darwin-arm64": "2.3.0-beta.5",
112
- "java-bridge-win32-ia32-msvc": "2.3.0-beta.5",
113
- "java-bridge-linux-arm64-gnu": "2.3.0-beta.5"
109
+ "java-bridge-win32-x64-msvc": "2.3.0-beta.7",
110
+ "java-bridge-darwin-x64": "2.3.0-beta.7",
111
+ "java-bridge-linux-x64-gnu": "2.3.0-beta.7",
112
+ "java-bridge-darwin-arm64": "2.3.0-beta.7",
113
+ "java-bridge-win32-ia32-msvc": "2.3.0-beta.7",
114
+ "java-bridge-linux-arm64-gnu": "2.3.0-beta.7"
114
115
  }
115
116
  }