@browserless/function 9.2.14 → 9.2.19

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 CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@browserless/function",
3
3
  "description": "Run abritrary JavaScript inside a browser sandbox",
4
4
  "homepage": "https://browserless.js.org",
5
- "version": "9.2.14",
5
+ "version": "9.2.19",
6
6
  "main": "src/index.js",
7
7
  "author": {
8
8
  "email": "hello@microlink.io",
@@ -29,7 +29,7 @@
29
29
  "serverless"
30
30
  ],
31
31
  "dependencies": {
32
- "@browserless/errors": "^9.2.14",
32
+ "@browserless/errors": "^9.2.15",
33
33
  "debug-logfmt": "~1.0.4",
34
34
  "deepmerge": "~4.2.2",
35
35
  "execa": "~5.1.1",
@@ -39,7 +39,7 @@
39
39
  "p-timeout": "~4.1.0",
40
40
  "require-one-of": "~1.0.15",
41
41
  "serialize-error": "~8.1.0",
42
- "vm2": "~3.9.3"
42
+ "vm2": "~3.9.5"
43
43
  },
44
44
  "devDependencies": {
45
45
  "ava": "latest",
@@ -61,5 +61,5 @@
61
61
  "timeout": "2m",
62
62
  "verbose": true
63
63
  },
64
- "gitHead": "c1c9dca5f97b375666eaab24137dc362dd5a8f69"
64
+ "gitHead": "e44bfcf5f5ead8f42ad758c200b8fc5c1be4a761"
65
65
  }
package/src/index.js CHANGED
@@ -62,7 +62,7 @@ module.exports = (
62
62
  // main
63
63
  const result = await pTimeout(task(), timeout, () => {
64
64
  isRejected = true
65
- subprocess.kill('SIGKILL')
65
+ if (subprocess) subprocess.kill('SIGKILL')
66
66
  throw browserTimeout({ timeout })
67
67
  })
68
68
 
package/src/vm.js CHANGED
@@ -1,13 +1,15 @@
1
1
  'use strict'
2
2
 
3
3
  const pReflect = require('p-reflect')
4
- const { NodeVM } = require('vm2')
5
4
  const merge = require('deepmerge')
5
+ const { NodeVM } = require('vm2')
6
+ const path = require('path')
6
7
 
7
8
  const DEFAULT_VM_OPTS = {
8
9
  console: 'off',
9
10
  sandbox: {},
10
11
  require: {
12
+ resolve: pkgName => path.resolve(process.cwd(), 'node_modules', pkgName),
11
13
  external: {
12
14
  modules: ['serialize-error', 'browserless']
13
15
  }