@browserless/function 13.6.12 → 13.7.0

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 +2 -2
  2. package/src/index.js +8 -1
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@browserless/function",
3
3
  "description": "Execute arbitrary JavaScript code in a secure browser sandbox with access to page DOM and network.",
4
4
  "homepage": "https://browserless.js.org",
5
- "version": "13.6.12",
5
+ "version": "13.7.0",
6
6
  "main": "src/index.js",
7
7
  "author": {
8
8
  "email": "hello@microlink.io",
@@ -57,5 +57,5 @@
57
57
  "timeout": "2m",
58
58
  "workerThreads": false
59
59
  },
60
- "gitHead": "363898247585b3b6cd51781fbd55ca61ee9ef8a6"
60
+ "gitHead": "518aa3f6d07c2794d0f58edd9805bbe08f06d6a3"
61
61
  }
package/src/index.js CHANGED
@@ -6,8 +6,15 @@ const requireOneOf = require('require-one-of')
6
6
  const createRunFunction = require('./function')
7
7
  const path = require('path')
8
8
 
9
+ // `isolated-function` reads these to know which dependencies a snippet requires
10
+ // are already on disk, so it can skip installing them. Walking up from a
11
+ // dependency only lands on the consumer's `node_modules` under a flat install:
12
+ // with pnpm it lands inside the isolated store, which holds that dependency's
13
+ // own dependencies and nothing else, so every snippet paid a fresh install.
14
+ // `module.paths` is the resolution chain Node itself would use from here, so it
15
+ // reaches the consumer under either layout.
9
16
  const cloudflareDir = path.dirname(require.resolve('@cloudflare/puppeteer/package.json'))
10
- const nodePaths = [path.resolve(cloudflareDir, '..', '..')]
17
+ const nodePaths = [...new Set([path.resolve(cloudflareDir, '..', '..'), ...module.paths])]
11
18
 
12
19
  const stringify = fn => fn.toString().trim().replace(/;$/, '')
13
20