browserless 9.7.0 → 9.7.1

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 (3) hide show
  1. package/package.json +7 -8
  2. package/src/index.js +5 -10
  3. package/LICENSE.md +0 -21
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "browserless",
3
3
  "description": "The headless Chrome/Chromium performance driver for Node.js",
4
4
  "homepage": "https://browserless.js.org",
5
- "version": "9.7.0",
5
+ "version": "9.7.1",
6
6
  "main": "src/index.js",
7
7
  "author": {
8
8
  "email": "hello@microlink.io",
@@ -31,10 +31,10 @@
31
31
  "text"
32
32
  ],
33
33
  "dependencies": {
34
- "@browserless/errors": "9.6.6",
35
- "@browserless/goto": "9.7.0",
36
- "@browserless/pdf": "9.7.0",
37
- "@browserless/screenshot": "9.7.0",
34
+ "@browserless/errors": "workspace:*",
35
+ "@browserless/goto": "workspace:*",
36
+ "@browserless/pdf": "workspace:*",
37
+ "@browserless/screenshot": "workspace:*",
38
38
  "debug-logfmt": "~1.0.4",
39
39
  "kill-process-group": "~1.0.3",
40
40
  "p-reflect": "~2.1.0",
@@ -44,7 +44,7 @@
44
44
  "superlock": "~1.0.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@browserless/test": "9.7.0",
47
+ "@browserless/test": "workspace:*",
48
48
  "ava": "3"
49
49
  },
50
50
  "engines": {
@@ -61,6 +61,5 @@
61
61
  "serial": true,
62
62
  "timeout": "30s",
63
63
  "verbose": true
64
- },
65
- "gitHead": "4da0a992dd779d5b7a6cc8a0bb8f9e918808f6e1"
64
+ }
66
65
  }
package/src/index.js CHANGED
@@ -6,7 +6,6 @@ const debug = require('debug-logfmt')('browserless')
6
6
  const createGoto = require('@browserless/goto')
7
7
  const createPdf = require('@browserless/pdf')
8
8
  const { withLock } = require('superlock')
9
- const { randomUUID } = require('crypto')
10
9
  const pReflect = require('p-reflect')
11
10
  const pTimeout = require('p-timeout')
12
11
  const pRetry = require('p-retry')
@@ -46,7 +45,7 @@ module.exports = ({ timeout: globalTimeout = 30000, ...launchOpts } = {}) => {
46
45
  })
47
46
 
48
47
  promise.then(async browser => {
49
- browser.once('disconnected', getBrowser)
48
+ if (launchOpts.mode !== 'connect') browser.once('disconnected', getBrowser)
50
49
  debug('spawn', {
51
50
  respawn: isRespawn,
52
51
  pid: driver.pid(browser) || launchOpts.mode,
@@ -60,9 +59,7 @@ module.exports = ({ timeout: globalTimeout = 30000, ...launchOpts } = {}) => {
60
59
  let browserProcessPromise = spawn()
61
60
 
62
61
  const createBrowserContext = contextOpts =>
63
- getBrowser()
64
- .then(browser => browser.createIncognitoBrowserContext(contextOpts))
65
- .then(context => (context._id = randomUUID()) && context)
62
+ getBrowser().then(browser => browser.createIncognitoBrowserContext(contextOpts))
66
63
 
67
64
  const getBrowser = async () => {
68
65
  if (isClosed) return browserProcessPromise
@@ -95,7 +92,7 @@ module.exports = ({ timeout: globalTimeout = 30000, ...launchOpts } = {}) => {
95
92
  getBrowserContext()
96
93
  ])
97
94
  const page = await browserContext.newPage()
98
- debug('createPage', { pid: driver.pid(browserProcess), id: browserContext._id })
95
+ debug('createPage', { pid: driver.pid(browserProcess), id: browserContext.id })
99
96
  return page
100
97
  }
101
98
 
@@ -106,7 +103,7 @@ module.exports = ({ timeout: globalTimeout = 30000, ...launchOpts } = {}) => {
106
103
  getBrowserContext(),
107
104
  pReflect(page.close())
108
105
  ])
109
- debug('closePage', { pid: driver.pid(browserProcess), id: browserContext._id })
106
+ debug('closePage', { pid: driver.pid(browserProcess), id: browserContext.id })
110
107
  }
111
108
  }
112
109
 
@@ -165,10 +162,8 @@ module.exports = ({ timeout: globalTimeout = 30000, ...launchOpts } = {}) => {
165
162
  getBrowser(),
166
163
  getBrowserContext()
167
164
  ])
168
- const id = browserContext._id
169
165
  await pReflect(browserContext.close())
170
-
171
- debug('destroyContext', { pid: driver.pid(browserProcess), id })
166
+ debug('destroyContext', { pid: driver.pid(browserProcess), id: browserContext.id })
172
167
  }
173
168
 
174
169
  return {
package/LICENSE.md DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright © 2019 Microlink <hello@microlink.io> (microlink.io)
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.