isolated-function 0.1.11 → 0.1.12
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/package.json +1 -2
- package/src/index.js +1 -2
- package/src/template/index.js +2 -1
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.12",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./src/index.js"
|
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
"ensure-error": "~3.0.1",
|
|
40
40
|
"esbuild": "~0.23.1",
|
|
41
41
|
"serialize-error": "8",
|
|
42
|
-
"serialize-javascript": "~6.0.2",
|
|
43
42
|
"tinyspawn": "~1.3.2"
|
|
44
43
|
},
|
|
45
44
|
"devDependencies": {
|
package/src/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const { deserializeError } = require('serialize-error')
|
|
4
|
-
const serialize = require('serialize-javascript')
|
|
5
4
|
const timeSpan = require('@kikobeats/time-span')()
|
|
6
5
|
const $ = require('tinyspawn')
|
|
7
6
|
const path = require('path')
|
|
@@ -37,7 +36,7 @@ module.exports = (snippet, { tmpdir, timeout, memory, throwError = true } = {})
|
|
|
37
36
|
const cwd = path.dirname(filepath)
|
|
38
37
|
const filename = path.basename(filepath)
|
|
39
38
|
duration = timeSpan()
|
|
40
|
-
const { stdout } = await $('node', [filename,
|
|
39
|
+
const { stdout } = await $('node', [filename, JSON.stringify(args)], {
|
|
41
40
|
cwd,
|
|
42
41
|
env: {
|
|
43
42
|
...process.env,
|
package/src/template/index.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
const SERIALIZE_ERROR = require('./serialize-error')
|
|
4
4
|
|
|
5
5
|
module.exports = snippet => `
|
|
6
|
-
const args =
|
|
6
|
+
const args = JSON.parse(process.argv[2])
|
|
7
|
+
|
|
7
8
|
const logging = Object.create(null)
|
|
8
9
|
|
|
9
10
|
for (const method of ['log', 'info', 'debug', 'warn', 'error']) {
|