datalevin-node 0.10.16 → 0.10.17
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.
|
Binary file
|
package/package.json
CHANGED
package/src/jvm.js
CHANGED
|
@@ -14,6 +14,13 @@ export const DATALEVIN_CLASSPATH_ENV = "DATALEVIN_CLASSPATH";
|
|
|
14
14
|
export const DATALEVIN_JVM_ARGS_ENV = "DATALEVIN_JVM_ARGS";
|
|
15
15
|
export const DATALEVIN_JAVACPP_CACHEDIR_ENV = "DATALEVIN_JAVACPP_CACHEDIR";
|
|
16
16
|
export const DEFAULT_JAVACPP_CACHEDIR = "/tmp/datalevin-javacpp-cache";
|
|
17
|
+
export const DEFAULT_JVM_ARGS = [
|
|
18
|
+
"--enable-native-access=ALL-UNNAMED",
|
|
19
|
+
"--add-opens=java.base/java.lang=ALL-UNNAMED",
|
|
20
|
+
"--add-opens=java.base/java.util=ALL-UNNAMED",
|
|
21
|
+
"--add-opens=java.base/java.nio=ALL-UNNAMED",
|
|
22
|
+
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED"
|
|
23
|
+
];
|
|
17
24
|
|
|
18
25
|
const TARGET_JAR_PATTERNS = [
|
|
19
26
|
/^datalevin-runtime-.*\.jar$/,
|
|
@@ -125,13 +132,25 @@ function ensureJavacppCachedirArg(jvmArgs) {
|
|
|
125
132
|
return jvmArgs;
|
|
126
133
|
}
|
|
127
134
|
|
|
135
|
+
function ensureDefaultJvmArgs(jvmArgs) {
|
|
136
|
+
for (const arg of DEFAULT_JVM_ARGS) {
|
|
137
|
+
if (!jvmArgs.includes(arg)) {
|
|
138
|
+
jvmArgs.push(arg);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return jvmArgs;
|
|
142
|
+
}
|
|
143
|
+
|
|
128
144
|
function resolveJvmArgs(jvmArgs = null) {
|
|
145
|
+
let resolved;
|
|
129
146
|
if (jvmArgs && jvmArgs.length > 0) {
|
|
130
|
-
|
|
147
|
+
resolved = [...jvmArgs];
|
|
148
|
+
} else {
|
|
149
|
+
const envArgs = process.env[DATALEVIN_JVM_ARGS_ENV];
|
|
150
|
+
resolved = splitShellWords(envArgs);
|
|
131
151
|
}
|
|
132
152
|
|
|
133
|
-
|
|
134
|
-
return ensureJavacppCachedirArg(splitShellWords(envArgs));
|
|
153
|
+
return ensureJavacppCachedirArg(ensureDefaultJvmArgs(resolved));
|
|
135
154
|
}
|
|
136
155
|
|
|
137
156
|
export function resolveClasspath(classpath = null) {
|
|
@@ -314,5 +333,6 @@ export const __testing = {
|
|
|
314
333
|
findRuntimeJars,
|
|
315
334
|
splitShellWords,
|
|
316
335
|
resolveJvmArgs,
|
|
336
|
+
ensureDefaultJvmArgs,
|
|
317
337
|
ensureJavacppCachedirArg
|
|
318
338
|
};
|