isolated-function 0.1.8 → 0.1.10
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 +0 -1
- package/package.json +1 -1
- package/src/index.js +5 -3
- package/src/template/index.js +1 -2
package/README.md
CHANGED
|
@@ -58,7 +58,6 @@ const [sum, teardown] = isolatedFunction((y, z) => y + z, {
|
|
|
58
58
|
|
|
59
59
|
/* interact with the isolated-function */
|
|
60
60
|
const { value, profiling } = await sum(3, 2)
|
|
61
|
-
console.log({ value, profiling })
|
|
62
61
|
|
|
63
62
|
/* close resources associated with the isolated-function initialization */
|
|
64
63
|
await teardown()
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "isolated-function",
|
|
3
3
|
"description": "Runs untrusted code in a Node.js v8 sandbox.",
|
|
4
4
|
"homepage": "https://github.com/Kikobeats/isolated-function",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.10",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./src/index.js"
|
package/src/index.js
CHANGED
|
@@ -35,11 +35,13 @@ module.exports = (snippet, { tmpdir, timeout, memory, throwError = true } = {})
|
|
|
35
35
|
|
|
36
36
|
const cwd = path.dirname(filepath)
|
|
37
37
|
const filename = path.basename(filepath)
|
|
38
|
-
const cmd = `node ${flags({ filename, memory })} ${filename} ${JSON.stringify(args)}`
|
|
39
|
-
|
|
40
38
|
duration = timeSpan()
|
|
41
|
-
const { stdout } = await $(
|
|
39
|
+
const { stdout } = await $('node', [filename, JSON.stringify(args)], {
|
|
42
40
|
cwd,
|
|
41
|
+
env: {
|
|
42
|
+
...process.env,
|
|
43
|
+
NODE_OPTIONS: flags({ filename, memory })
|
|
44
|
+
},
|
|
43
45
|
timeout,
|
|
44
46
|
killSignal: 'SIGKILL'
|
|
45
47
|
})
|
package/src/template/index.js
CHANGED
|
@@ -9,8 +9,7 @@ module.exports = snippet => `
|
|
|
9
9
|
|
|
10
10
|
for (const method of ['log', 'info', 'debug', 'warn', 'error']) {
|
|
11
11
|
console[method] = function (...args) {
|
|
12
|
-
|
|
13
|
-
logging[method] === undefined ? logging[method] = [input] : logging[method].push(input)
|
|
12
|
+
logging[method] === undefined ? logging[method] = [args] : logging[method].push(args)
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
15
|
|