isolated-function 0.1.15 → 0.1.16

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.15",
5
+ "version": "0.1.16",
6
6
  "main": "src/index.js",
7
7
  "exports": {
8
8
  ".": "./src/index.js"
@@ -21,12 +21,12 @@ const MINIFY = (() => {
21
21
  }
22
22
  })()
23
23
 
24
- const packageManager = (() => {
24
+ const install = (() => {
25
25
  try {
26
26
  execSync('which pnpm').toString().trim()
27
- return { init: 'pnpm init', install: 'pnpm install' }
27
+ return 'pnpm install'
28
28
  } catch {
29
- return { init: 'npm init --yes', install: 'npm install' }
29
+ return 'npm install'
30
30
  }
31
31
  })()
32
32
 
@@ -44,9 +44,9 @@ module.exports = async (snippet, tmpdir = tmpdirDefault) => {
44
44
  const content = transformDependencies(compiledTemplate)
45
45
  const tmpDir = await duration('tmpdir', tmpdir)
46
46
 
47
- await duration('npm:init', () => $(packageManager.init, { cwd: tmpDir.cwd }))
47
+ await duration('npm:init', () => fs.writeFile(path.join(tmpDir.cwd, 'package.json'), '{}'))
48
48
  await duration('npm:install', () =>
49
- $(`${packageManager.install} ${dependencies.join(' ')}`, { cwd: tmpDir.cwd })
49
+ $(`${install} ${dependencies.join(' ')}`, { cwd: tmpDir.cwd })
50
50
  )
51
51
 
52
52
  const result = await duration('esbuild', () =>