isolated-function 0.1.21 → 0.1.22

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": "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.21",
5
+ "version": "0.1.22",
6
6
  "main": "src/index.js",
7
7
  "exports": {
8
8
  ".": "./src/index.js"
@@ -23,7 +23,9 @@ module.exports = async (snippet, tmpdir = tmpdirDefault) => {
23
23
 
24
24
  const content = transformDependencies(compiledTemplate)
25
25
  const tmpDir = await duration('tmpdir', tmpdir)
26
- await duration('npm:install', () => installDependencies({ dependencies, cwd: tmpDir.cwd }))
26
+ await duration('npm:install', () => installDependencies({ dependencies, cwd: tmpDir.cwd }), {
27
+ dependencies
28
+ })
27
29
  const result = await duration('esbuild', () => build({ content, cwd: tmpDir.cwd }))
28
30
 
29
31
  return {
package/src/debug.js CHANGED
@@ -2,16 +2,16 @@
2
2
 
3
3
  const debug = require('debug-logfmt')('isolated-function')
4
4
 
5
- const duration = async (name, fn) => {
5
+ const duration = async (name, fn, props) => {
6
6
  const duration = debug.duration(name)
7
7
 
8
8
  return Promise.resolve(fn())
9
9
  .then(result => {
10
- duration()
10
+ props ? duration(props) : duration()
11
11
  return result
12
12
  })
13
13
  .catch(error => {
14
- duration.error()
14
+ props ? duration.error(props) : duration.duration.error()
15
15
  throw error
16
16
  })
17
17
  }