grover 1.1.4 → 1.1.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 605a1ddd3d51f652e03c28d8f6ab97b45e9f026884da2ea4772b57fc83287dd2
4
- data.tar.gz: c4bc0069f551b4e15df0b59b42175b20bc3d8130fb2981b947b832e0f2e48e14
3
+ metadata.gz: 9685b557f5d1cdc200fe5806aadc59106ccb9d6572e4d57c1660964286b3f4c7
4
+ data.tar.gz: b0584418598e6ca66b097b8e9ffc87ad5bbd6ae64becf74966ceef4b4d894730
5
5
  SHA512:
6
- metadata.gz: cfdb35168bba8db20bc0ba7cf027d13ebb61670f2a89f059710129cdd3c7460f0b95f80a0cc7fbd2f334ca25348e733eccd1ce00bd380e6d65282e3018161572
7
- data.tar.gz: '08cdc3c9c5ce2bf8c3d9c7d155db3cb558dd77e718008f7c8d5662188bf78071b611e3ad3aa2b3f32800b6595c492222c6f1a99768a2be983aa4e5e7f37b12f5'
6
+ metadata.gz: cfad1954989183edd8f9cd238085c6031ec9cfca25b61dbe6e83fd33bd733c4d60b97b64da59d9b6301b538aa26979e8e9813b40765fa34fd03a17f47f46897c
7
+ data.tar.gz: e06271f0ede0792519f7a6d1156b04e5d5465921b8b75d36438fffdf62a491c54029c73f070de6241cb4cb1654e548024115634fe27c80fa1ee1b056375d20c9
@@ -16,35 +16,46 @@ const path = require('path');
16
16
 
17
17
  const _processPage = (async (convertAction, urlOrHtml, options) => {
18
18
  let browser, errors = [], tmpDir;
19
- try {
20
- tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'grover-'));
21
-
22
- const launchParams = {
23
- args: process.env.GROVER_NO_SANDBOX === 'true' ? ['--no-sandbox', '--disable-setuid-sandbox'] : [],
24
- userDataDir: tmpDir
25
- };
26
19
 
20
+ try {
27
21
  // Configure puppeteer debugging options
28
22
  const debug = options.debug; delete options.debug;
29
- if (typeof debug === 'object' && !!debug) {
30
- if (debug.headless !== undefined) { launchParams.headless = debug.headless; }
31
- if (debug.devtools !== undefined) { launchParams.devtools = debug.devtools; }
32
- }
33
-
34
- // Configure additional launch arguments
35
- const args = options.launchArgs; delete options.launchArgs;
36
- if (Array.isArray(args)) {
37
- launchParams.args = launchParams.args.concat(args);
38
- }
23
+ const browserWsEndpoint = options.browserWsEndpoint; delete options.browserWsEndpoint;
24
+ if (typeof browserWsEndpoint === "string") {
25
+ const connectParams = {
26
+ browserWSEndpoint: browserWsEndpoint,
27
+ };
39
28
 
40
- // Set executable path if given
41
- const executablePath = options.executablePath; delete options.executablePath;
42
- if (executablePath) {
43
- launchParams.executablePath = executablePath;
29
+ browser = await puppeteer.connect(connectParams);
30
+ } else {
31
+ tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'grover-'));
32
+
33
+ const launchParams = {
34
+ args: process.env.GROVER_NO_SANDBOX === 'true' ? ['--no-sandbox', '--disable-setuid-sandbox'] : [],
35
+ userDataDir: tmpDir
36
+ };
37
+
38
+ if (typeof debug === 'object' && !!debug) {
39
+ if (debug.headless !== undefined) { launchParams.headless = debug.headless; }
40
+ if (debug.devtools !== undefined) { launchParams.devtools = debug.devtools; }
41
+ }
42
+
43
+ // Configure additional launch arguments
44
+ const args = options.launchArgs; delete options.launchArgs;
45
+ if (Array.isArray(args)) {
46
+ launchParams.args = launchParams.args.concat(args);
47
+ }
48
+
49
+ // Set executable path if given
50
+ const executablePath = options.executablePath; delete options.executablePath;
51
+ if (executablePath) {
52
+ launchParams.executablePath = executablePath;
53
+ }
54
+
55
+ // Launch the browser and create a page
56
+ browser = await puppeteer.launch(launchParams);
44
57
  }
45
58
 
46
- // Launch the browser and create a page
47
- browser = await puppeteer.launch(launchParams);
48
59
  const page = await browser.newPage();
49
60
 
50
61
  // Basic auth
@@ -8,7 +8,7 @@ class Grover
8
8
  # Build options from Grover.configuration, meta_options, and passed-in options
9
9
  #
10
10
  class OptionsBuilder < Hash
11
- def initialize(options, url) # rubocop:disable Lint/MissingSuper
11
+ def initialize(options, url)
12
12
  @url = url
13
13
  combined = grover_configuration
14
14
  Utils.deep_merge! combined, Utils.deep_stringify_keys(options)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Grover
4
- VERSION = '1.1.4'
4
+ VERSION = '1.1.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grover
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Bromwich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-05 00:00:00.000000000 Z
11
+ date: 2023-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: combine_pdf
@@ -215,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
215
  - !ruby/object:Gem::Version
216
216
  version: '0'
217
217
  requirements: []
218
- rubygems_version: 3.4.4
218
+ rubygems_version: 3.2.3
219
219
  signing_key:
220
220
  specification_version: 4
221
221
  summary: A Ruby gem to transform HTML into PDF, PNG or JPEG by wrapping the NodeJS