isolated-function 0.1.34 → 0.1.35

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +5 -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.34",
5
+ "version": "0.1.35",
6
6
  "main": "src/index.js",
7
7
  "exports": {
8
8
  ".": "./src/index.js"
package/src/index.js CHANGED
@@ -15,8 +15,12 @@ const createError = ({ name, message, ...props }) => {
15
15
  return error
16
16
  }
17
17
 
18
+ const [major] = process.version.slice(1).split('.').map(Number)
19
+
20
+ const PERMISSION_FLAG = major >= 24 ? '--permission' : '--experimental-permission'
21
+
18
22
  const flags = ({ memory }) => {
19
- const flags = ['--disable-warning=ExperimentalWarning', '--experimental-permission']
23
+ const flags = ['--disable-warning=ExperimentalWarning', PERMISSION_FLAG]
20
24
  if (memory) flags.push(`--max-old-space-size=${memory}`)
21
25
  return flags.join(' ')
22
26
  }