@browserless/capture 10.11.2 → 10.11.3
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 +4 -4
- package/src/capture.js +3 -3
- package/src/constants.js +6 -13
- package/src/index.js +3 -2
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@browserless/capture",
|
|
3
3
|
"description": "Record a Puppeteer page using tabCapture API",
|
|
4
4
|
"homepage": "https://browserless.js.org/#/?id=capturepage-options",
|
|
5
|
-
"version": "10.11.
|
|
5
|
+
"version": "10.11.3",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"author": {
|
|
8
8
|
"email": "hello@microlink.io",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"webm"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@browserless/goto": "^10.11.
|
|
33
|
+
"@browserless/goto": "^10.11.3",
|
|
34
34
|
"debug-logfmt": "~1.4.8",
|
|
35
35
|
"ws": "~8.19.0"
|
|
36
36
|
},
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"ava": "5"
|
|
39
39
|
},
|
|
40
40
|
"engines": {
|
|
41
|
-
"node": ">=
|
|
41
|
+
"node": ">= 24"
|
|
42
42
|
},
|
|
43
43
|
"files": [
|
|
44
44
|
"extension",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"timeout": "2m",
|
|
56
56
|
"workerThreads": false
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "2f86ba8d35c9b92c3c19e310282a3d24d0e0c7e0"
|
|
59
59
|
}
|
package/src/capture.js
CHANGED
|
@@ -7,7 +7,7 @@ const debug = require('debug-logfmt')('browserless:capture')
|
|
|
7
7
|
const { closeServer, createWebSocketServer } = require('./util')
|
|
8
8
|
const extension = require('./extension')
|
|
9
9
|
|
|
10
|
-
const { INTERNAL_FRAME_SIZE, NOOP } = require('./constants')
|
|
10
|
+
const { DEFAULT, INTERNAL_FRAME_SIZE, NOOP } = require('./constants')
|
|
11
11
|
|
|
12
12
|
let currentIndex = 0
|
|
13
13
|
|
|
@@ -78,7 +78,7 @@ const SUPPORTED_TYPES = Object.freeze(Object.keys(MIME_TYPES_BY_TYPE))
|
|
|
78
78
|
const getMimeType = ({ type, audio, video }) => {
|
|
79
79
|
const normalizedType =
|
|
80
80
|
type === undefined || type === null
|
|
81
|
-
?
|
|
81
|
+
? DEFAULT.type
|
|
82
82
|
: String(type).trim().toLowerCase().replace(/^\./, '')
|
|
83
83
|
|
|
84
84
|
const mimeTypes = MIME_TYPES_BY_TYPE[normalizedType]
|
|
@@ -160,7 +160,7 @@ const getTargetId = async page => {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
module.exports = async (page, opts, viewport) => {
|
|
163
|
-
const { path: outputPath, duration =
|
|
163
|
+
const { path: outputPath, duration = DEFAULT.duration, audio, video, type } = opts
|
|
164
164
|
|
|
165
165
|
const audioOpts = getOpts(audio, false, 'audio')
|
|
166
166
|
const videoOpts = getOpts(video, true, 'video')
|
package/src/constants.js
CHANGED
|
@@ -2,18 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
const path = require('path')
|
|
4
4
|
|
|
5
|
-
const EXTENSION_ID = 'jjndjgheafjngoipoacpjgeicjeomjli'
|
|
6
|
-
|
|
7
|
-
const EXTENSION_PATH = path.join(__dirname, '..', 'extension')
|
|
8
|
-
|
|
9
|
-
const TYPES = Object.freeze(['webm', 'mp4'])
|
|
10
|
-
const INTERNAL_FRAME_SIZE = 250
|
|
11
|
-
const NOOP = () => {}
|
|
12
|
-
|
|
13
5
|
module.exports = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
DEFAULT: Object.freeze({ duration: 3000, type: 'webm' }),
|
|
7
|
+
EXTENSION_ID: 'jjndjgheafjngoipoacpjgeicjeomjli',
|
|
8
|
+
EXTENSION_PATH: path.join(__dirname, '..', 'extension'),
|
|
9
|
+
TYPES: Object.freeze(['webm', 'mp4']),
|
|
10
|
+
INTERNAL_FRAME_SIZE: 250,
|
|
11
|
+
NOOP: () => {}
|
|
19
12
|
}
|
package/src/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const debug = require('debug-logfmt')('browserless:capture')
|
|
4
4
|
const createGoto = require('@browserless/goto')
|
|
5
5
|
|
|
6
|
-
const { EXTENSION_ID, EXTENSION_PATH, TYPES } = require('./constants')
|
|
6
|
+
const { DEFAULT, EXTENSION_ID, EXTENSION_PATH, TYPES } = require('./constants')
|
|
7
7
|
const runCapture = require('./capture')
|
|
8
8
|
|
|
9
9
|
module.exports = ({ goto, ...gotoOpts } = {}) => {
|
|
@@ -11,7 +11,7 @@ module.exports = ({ goto, ...gotoOpts } = {}) => {
|
|
|
11
11
|
return function capture (page) {
|
|
12
12
|
return async (url, opts = {}) => {
|
|
13
13
|
const duration = debug.duration({ url })
|
|
14
|
-
const { device } = await goto(page, { ...opts, url })
|
|
14
|
+
const { device } = await goto(page, { ...opts, url, animations: true })
|
|
15
15
|
const result = await runCapture(page, opts, device.viewport)
|
|
16
16
|
duration.info()
|
|
17
17
|
return result
|
|
@@ -22,3 +22,4 @@ module.exports = ({ goto, ...gotoOpts } = {}) => {
|
|
|
22
22
|
module.exports.extensionPath = EXTENSION_PATH
|
|
23
23
|
module.exports.extensionId = EXTENSION_ID
|
|
24
24
|
module.exports.types = TYPES
|
|
25
|
+
module.exports.DEFAULT = DEFAULT
|