Dhalang 0.6.2 → 0.6.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 +4 -4
- data/.travis.yml +14 -6
- data/Dhalang.gemspec +4 -4
- data/Gemfile.lock +25 -28
- data/README.md +39 -25
- data/lib/Dhalang/puppeteer.rb +17 -16
- data/lib/Dhalang/version.rb +1 -1
- data/lib/Screenshot.rb +24 -7
- data/lib/js/dhalang.js +22 -2
- data/lib/js/screenshot-generator.js +2 -2
- data/package-lock.json +180 -81
- data/package.json +2 -2
- metadata +17 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 35f7dcd3cc7787c9e13429033b9c177d6f5c82f0b94364a2d4efbe3ffe601a16
|
|
4
|
+
data.tar.gz: b204fe4df6c7b3e0da1e7d59407a711a9bd1d9f41c7828b05eccc478499e2b0b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 25c582e213b4b26851e59859ab24115f136ea02b4b2889eb99502a9b3d3ddc7688f667ffe656d4f79afb81a65dda0b81a2e482a8d310890a1baf5c11fd17dbc0
|
|
7
|
+
data.tar.gz: 3cd5d4ece1b4e8f87a59abeb781ae241e8b7a515665f6b5c57cc636ccb767a98ebc7a7be71f7746f379bf71d083aba33eb7003c524e9efa1d652d77a940b2656
|
data/.travis.yml
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
language: ruby
|
|
2
2
|
node_js:
|
|
3
|
-
|
|
3
|
+
- node
|
|
4
4
|
rvm:
|
|
5
|
-
|
|
5
|
+
- 2.6
|
|
6
6
|
addons:
|
|
7
7
|
chrome: stable
|
|
8
8
|
before_install:
|
|
9
|
-
|
|
9
|
+
- nvm install v15.0.1
|
|
10
10
|
install:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
script: bundle exec rake spec
|
|
11
|
+
- bundle install
|
|
12
|
+
- npm install
|
|
13
|
+
script: bundle exec rake spec
|
|
14
|
+
deploy:
|
|
15
|
+
provider: rubygems
|
|
16
|
+
gemspec: Dhalang.gemspec
|
|
17
|
+
api_key:
|
|
18
|
+
secure: PMiaYF8Xtyyl9Kuhf9WwDRaUzUcqbe430DF8Rwk2qYM1oI8eiYbESswHVavAnrT+ZLKZVzp0+avXJ1TFjoz2tHBa7YVmmz76+RvECozwBXFVofK0GX8c6PVZTuuHgoanr1RVv0KTJOZXs5Aa+372Er31ESuwaaRPU2y/d8aotxtoe7MUoVle67S7Z28H53jwDCut54WFq6hKi+gNO/B+7y/e2efPgrqSktHxaPDGcaUaX9v8fAYBJgAulJLYMeRj+m7IQccajIjppr7vWDE1m9XEDAK71i3EZis96/z+KexB2bo3+Qc+TvpTWP5NeKw61uhtPn9HU4+XCaOV8Vz0e6PH2JfS82h333BcSifXjcFb9iQU8aEMpSpcjraUvvvu8JZepUUO//vtGEJLyOJ0L4f9XiUPhQ15OYjBsJ2ADFdNcqyFeASDuLoeKbAQrWunyTStb+wFrr5TzAoQp9ItZbEt6eHaI6WSd4qhJfzqU7NOzE06Ns03J1jMdmzMxREl8ENJFle65fQouQfRnfcZTS6qW7UX/7YZUiMw60Cpa15qHW+92glCkOuiZUhr4D999ejqMFY5Jd3tHGVBX0/1MWc2jl0fPk2/fueA/YW8xLd3xKP9p0KhbqWZhiMxIct5w718nfOLuSoL1VLJRImj4HAKmoCFKP4RE+1Vl95UwEY=
|
|
19
|
+
on:
|
|
20
|
+
branch: master
|
|
21
|
+
tags: true
|
data/Dhalang.gemspec
CHANGED
|
@@ -22,9 +22,9 @@ Gem::Specification.new do |spec|
|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
23
23
|
spec.require_paths = ["lib"]
|
|
24
24
|
|
|
25
|
-
spec.add_development_dependency "bundler", "~>
|
|
26
|
-
spec.add_development_dependency "
|
|
25
|
+
spec.add_development_dependency "bundler", "~> 2.3.6"
|
|
26
|
+
spec.add_development_dependency "fastimage", "~> 2.2.6"
|
|
27
|
+
spec.add_development_dependency "pdf-reader", "~> 2.9.0"
|
|
28
|
+
spec.add_development_dependency "rake", "~> 13.0.6"
|
|
27
29
|
spec.add_development_dependency "rspec", "~> 3.0"
|
|
28
|
-
spec.add_development_dependency "pdf-reader", "~> 2.2"
|
|
29
|
-
spec.add_development_dependency "fastimage", "~> 1.8"
|
|
30
30
|
end
|
data/Gemfile.lock
CHANGED
|
@@ -1,52 +1,49 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
Dhalang (0.6.
|
|
4
|
+
Dhalang (0.6.4)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
|
-
Ascii85 (1.0
|
|
10
|
-
addressable (2.3.8)
|
|
9
|
+
Ascii85 (1.1.0)
|
|
11
10
|
afm (0.2.2)
|
|
12
|
-
diff-lcs (1.
|
|
13
|
-
fastimage (
|
|
14
|
-
addressable (~> 2.3.5)
|
|
11
|
+
diff-lcs (1.5.0)
|
|
12
|
+
fastimage (2.2.6)
|
|
15
13
|
hashery (2.1.2)
|
|
16
|
-
pdf-reader (2.
|
|
17
|
-
Ascii85 (~> 1.0
|
|
14
|
+
pdf-reader (2.9.2)
|
|
15
|
+
Ascii85 (~> 1.0)
|
|
18
16
|
afm (~> 0.2.1)
|
|
19
17
|
hashery (~> 2.0)
|
|
20
18
|
ruby-rc4
|
|
21
19
|
ttfunk
|
|
22
|
-
rake (13.0.
|
|
23
|
-
rspec (3.
|
|
24
|
-
rspec-core (~> 3.
|
|
25
|
-
rspec-expectations (~> 3.
|
|
26
|
-
rspec-mocks (~> 3.
|
|
27
|
-
rspec-core (3.
|
|
28
|
-
rspec-support (~> 3.
|
|
29
|
-
rspec-expectations (3.
|
|
20
|
+
rake (13.0.6)
|
|
21
|
+
rspec (3.11.0)
|
|
22
|
+
rspec-core (~> 3.11.0)
|
|
23
|
+
rspec-expectations (~> 3.11.0)
|
|
24
|
+
rspec-mocks (~> 3.11.0)
|
|
25
|
+
rspec-core (3.11.0)
|
|
26
|
+
rspec-support (~> 3.11.0)
|
|
27
|
+
rspec-expectations (3.11.0)
|
|
30
28
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
31
|
-
rspec-support (~> 3.
|
|
32
|
-
rspec-mocks (3.
|
|
29
|
+
rspec-support (~> 3.11.0)
|
|
30
|
+
rspec-mocks (3.11.1)
|
|
33
31
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
34
|
-
rspec-support (~> 3.
|
|
35
|
-
rspec-support (3.
|
|
32
|
+
rspec-support (~> 3.11.0)
|
|
33
|
+
rspec-support (3.11.0)
|
|
36
34
|
ruby-rc4 (0.1.5)
|
|
37
|
-
ttfunk (1.
|
|
35
|
+
ttfunk (1.7.0)
|
|
38
36
|
|
|
39
37
|
PLATFORMS
|
|
40
|
-
|
|
41
|
-
x64-mingw32
|
|
38
|
+
x86_64-darwin-20
|
|
42
39
|
|
|
43
40
|
DEPENDENCIES
|
|
44
41
|
Dhalang!
|
|
45
|
-
bundler (~>
|
|
46
|
-
fastimage (~>
|
|
47
|
-
pdf-reader (~> 2.
|
|
48
|
-
rake (~> 13.0.
|
|
42
|
+
bundler (~> 2.3.6)
|
|
43
|
+
fastimage (~> 2.2.6)
|
|
44
|
+
pdf-reader (~> 2.9.0)
|
|
45
|
+
rake (~> 13.0.6)
|
|
49
46
|
rspec (~> 3.0)
|
|
50
47
|
|
|
51
48
|
BUNDLED WITH
|
|
52
|
-
|
|
49
|
+
2.3.15
|
data/README.md
CHANGED
|
@@ -27,19 +27,32 @@ Install puppeteer in your application's root directory:
|
|
|
27
27
|
<sub>NodeJS v10.18.1 or greater is required</sub>
|
|
28
28
|
## Usage
|
|
29
29
|
__Get a PDF of a website url__
|
|
30
|
-
|
|
30
|
+
```ruby
|
|
31
|
+
Dhalang::PDF.get_from_url("https://www.google.com")
|
|
32
|
+
```
|
|
31
33
|
It is important to pass the complete url, leaving out https://, http:// or www. will result in an error.
|
|
32
|
-
|
|
34
|
+
|
|
33
35
|
__Get a PDF of a HTML string__
|
|
34
|
-
|
|
36
|
+
```ruby
|
|
37
|
+
Dhalang::PDF.get_from_html("<html><head></head><body><h1>examplestring</h1></body></html>")
|
|
38
|
+
```
|
|
35
39
|
|
|
36
40
|
__Get a PNG screenshot of a website__
|
|
37
|
-
|
|
41
|
+
```ruby
|
|
42
|
+
Dhalang::Screenshot.get_from_url("https://www.google.com", :png)
|
|
43
|
+
```
|
|
38
44
|
|
|
39
45
|
__Get a JPEG screenshot of a website__
|
|
40
|
-
|
|
46
|
+
```ruby
|
|
47
|
+
Dhalang::Screenshot.get_from_url("https://www.google.com", :jpeg)
|
|
48
|
+
```
|
|
41
49
|
|
|
42
|
-
|
|
50
|
+
__Get a WEBP screenshot of a website__
|
|
51
|
+
```ruby
|
|
52
|
+
Dhalang::Screenshot.get_from_url("https://www.google.com", :webp)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
All methods return a string containing the PDF or JPEG/PNG/WEBP in binary.
|
|
43
56
|
|
|
44
57
|
|
|
45
58
|
|
|
@@ -47,31 +60,40 @@ All methods return a string containing the PDF or JPEG/PNG in binary.
|
|
|
47
60
|
To override the default options that are set by Dhalang you can pass as last argument a hash with the custom options you want to set.
|
|
48
61
|
|
|
49
62
|
For example to set custom margins for PDFs:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
63
|
+
```ruby
|
|
64
|
+
Dhalang::PDF.get_from_url("https://www.google.com", {margin: { top: 100, right: 100, bottom: 100, left: 100}})
|
|
65
|
+
```
|
|
53
66
|
|
|
54
67
|
For example to only take a screenshot of the visible part of the page:
|
|
55
|
-
|
|
56
|
-
|
|
68
|
+
```ruby
|
|
69
|
+
Dhalang::Screenshot.get_from_url("https://www.google.com", :webp, {fullPage: false})
|
|
70
|
+
```
|
|
57
71
|
|
|
58
72
|
A list of all possible PDF options that can be set, can be found at: https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagepdfoptions
|
|
59
73
|
|
|
60
74
|
A list of all possible screenshot options that can be set, can be found at: https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagescreenshotoptions
|
|
61
75
|
|
|
62
|
-
|
|
76
|
+
> The default Puppeteer options contain the options `headerTemplate` and `footerTemplate`. Puppeteer expects these to be HTML strings. By default, the Dhalang
|
|
77
|
+
> gem passes all options as arguments in a `node ...` shell command. In case the HTML strings are too long they might surpass the maximum
|
|
78
|
+
> argument length of the host. For example, on Linux the `MAX_ARG_LEN` is 128kB. Therefore, you can also pass the headers and footers as file path using the
|
|
79
|
+
> options `headerTemplateFile` and `footerTemplateFile`. These non-Puppeteer-options will be used to populate the Puppeteer-options `headerTemplate` and `footerTemplate`.
|
|
80
|
+
>
|
|
81
|
+
> For example: `Dhalang::PDF.get_from_url("https://www.google.com", {headerTemplateFile: '/tmp/header.html', footerTemplateFile: '/tmp/footer.html'})`
|
|
63
82
|
|
|
64
83
|
|
|
65
84
|
## Custom user options
|
|
66
85
|
You may want to change the way Dhalang interacts with Puppeteer in general. User options can be set by providing them in a hash as last argument to any calls you make to the library. Are you setting both custom PDF and user options? Then they should be passed as a single hash.
|
|
67
86
|
|
|
68
87
|
For example to set a custom navigation timeout:
|
|
69
|
-
|
|
88
|
+
```ruby
|
|
89
|
+
Dhalang::Screenshot.get_from_url("https://www.google.com", :jpeg, {navigationTimeout: 20000})
|
|
90
|
+
```
|
|
70
91
|
|
|
71
92
|
Below table lists all possible configuration parameters that can be set:
|
|
72
93
|
| Key | Description | Default |
|
|
73
94
|
|--------------------|-----------------------------------------------------------------------------------------|---------------------------------|
|
|
74
95
|
| navigationTimeout | Amount of milliseconds until Puppeteer while timeout when navigating to the given page | 10000 |
|
|
96
|
+
| printToPDFTimeout | Amount of milliseconds until Puppeteer while timeout when calling Page.printToPDF | 0 (unlimited) |
|
|
75
97
|
| navigationWaitForSelector | If set, Dhalang will wait for the specified selector to appear before creating the screenshot or PDF | None |
|
|
76
98
|
| navigationWaitForXPath | If set, Dhalang will wait for the specified XPath to appear before creating the screenshot or PDF | None |
|
|
77
99
|
| userAgent | User agent to send with the request | Default Puppeteer one |
|
|
@@ -79,7 +101,7 @@ Below table lists all possible configuration parameters that can be set:
|
|
|
79
101
|
| isAutoHeight | When set to true the height of generated PDFs will be based on the scrollHeight property of the document body | false |
|
|
80
102
|
| viewPort | Custom viewport to use for the request | Default Puppeteer one |
|
|
81
103
|
| httpAuthenticationCredentials | Custom HTTP authentication credentials to use for the request | None |
|
|
82
|
-
|
|
104
|
+
| chromeOptions | A array of [options](https://peter.sh/experiments/chromium-command-line-switches/) that can be passed to puppeteer in addition to the mandatory `['--no-sandbox', '--disable-setuid-sandbox']` | [] |
|
|
83
105
|
|
|
84
106
|
|
|
85
107
|
## Examples of using Dhalang
|
|
@@ -91,18 +113,10 @@ def example_controller_method
|
|
|
91
113
|
end
|
|
92
114
|
```
|
|
93
115
|
|
|
94
|
-
To return a
|
|
116
|
+
To return a screenshot from a Rails controller you can do the following:
|
|
95
117
|
```ruby
|
|
96
118
|
def example_controller_method
|
|
97
|
-
binary_png = Dhalang::Screenshot.
|
|
119
|
+
binary_png = Dhalang::Screenshot.get_from_url("https://www.google.com", :png)
|
|
98
120
|
send_data(binary_png, filename: 'screenshotofgoogle.png', type: 'image/png')
|
|
99
121
|
end
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
To return a JPEG from a Rails controller you can do the following:
|
|
103
|
-
```ruby
|
|
104
|
-
def example_controller_method
|
|
105
|
-
binary_jpeg = Dhalang::Screenshot.get_from_url_as_jpeg("https://www.google.com")
|
|
106
|
-
send_data(binary_jpeg, filename: 'screenshotofgoogle.jpeg', type: 'image/jpeg')
|
|
107
|
-
end
|
|
108
|
-
```
|
|
122
|
+
```
|
data/lib/Dhalang/puppeteer.rb
CHANGED
|
@@ -5,15 +5,17 @@ module Dhalang
|
|
|
5
5
|
private_constant :NODE_MODULES_PATH
|
|
6
6
|
|
|
7
7
|
USER_OPTIONS = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
navigationTimeout: 10000,
|
|
9
|
+
printToPDFTimeout: 0, # unlimited
|
|
10
|
+
navigationWaitUntil: 'load',
|
|
11
|
+
navigationWaitForSelector: '',
|
|
12
|
+
navigationWaitForXPath: '',
|
|
13
|
+
userAgent: '',
|
|
14
|
+
isHeadless: true,
|
|
15
|
+
viewPort: '',
|
|
16
|
+
httpAuthenticationCredentials: '',
|
|
17
|
+
isAutoHeight: false,
|
|
18
|
+
chromeOptions: []
|
|
17
19
|
}
|
|
18
20
|
private_constant :USER_OPTIONS
|
|
19
21
|
|
|
@@ -22,6 +24,8 @@ module Dhalang
|
|
|
22
24
|
displayHeaderFooter: false,
|
|
23
25
|
headerTemplate: '',
|
|
24
26
|
footerTemplate: '',
|
|
27
|
+
headerTemplateFile: '',
|
|
28
|
+
footerTemplateFile: '',
|
|
25
29
|
printBackground: true,
|
|
26
30
|
landscape: false,
|
|
27
31
|
pageRanges: '',
|
|
@@ -34,18 +38,15 @@ module Dhalang
|
|
|
34
38
|
}
|
|
35
39
|
private_constant :DEFAULT_PDF_OPTIONS
|
|
36
40
|
|
|
37
|
-
|
|
41
|
+
DEFAULT_SCREENSHOT_OPTIONS = {
|
|
38
42
|
fullPage: true,
|
|
39
43
|
clip: nil,
|
|
40
44
|
omitBackground: false
|
|
41
45
|
}
|
|
42
|
-
private_constant :
|
|
46
|
+
private_constant :DEFAULT_SCREENSHOT_OPTIONS
|
|
43
47
|
|
|
44
48
|
DEFAULT_JPEG_OPTIONS = {
|
|
45
|
-
quality: 100
|
|
46
|
-
fullPage: true,
|
|
47
|
-
clip: nil,
|
|
48
|
-
omitBackground: false
|
|
49
|
+
quality: 100
|
|
49
50
|
}
|
|
50
51
|
private_constant :DEFAULT_JPEG_OPTIONS
|
|
51
52
|
|
|
@@ -88,7 +89,7 @@ module Dhalang
|
|
|
88
89
|
imageType: temp_file_extension,
|
|
89
90
|
userOptions: USER_OPTIONS.map { |option, value| [option, options.has_key?(option) ? options[option] : value]}.to_h,
|
|
90
91
|
pdfOptions: DEFAULT_PDF_OPTIONS.map { |option, value| [option, options.has_key?(option) ? options[option] : value] }.to_h,
|
|
91
|
-
|
|
92
|
+
screenshotOptions: DEFAULT_SCREENSHOT_OPTIONS.map { |option, value| [option, options.has_key?(option) ? options[option] : value] }.to_h,
|
|
92
93
|
jpegOptions: DEFAULT_JPEG_OPTIONS.map { |option, value| [option, options.has_key?(option) ? options[option] : value] }.to_h
|
|
93
94
|
}.to_json
|
|
94
95
|
end
|
data/lib/Dhalang/version.rb
CHANGED
data/lib/Screenshot.rb
CHANGED
|
@@ -2,8 +2,11 @@ module Dhalang
|
|
|
2
2
|
# Allows consumers of this library to take screenshots with Puppeteer.
|
|
3
3
|
class Screenshot
|
|
4
4
|
PUPPETEER_SCRIPT_PATH = File.expand_path('../js/screenshot-generator.js', __FILE__).freeze
|
|
5
|
+
IMAGE_TYPES = [:jpeg, :png, :webp].freeze
|
|
5
6
|
private_constant :PUPPETEER_SCRIPT_PATH
|
|
7
|
+
private_constant :IMAGE_TYPES
|
|
6
8
|
|
|
9
|
+
# <b>DEPRECATED:</b> Please use `get_from_url(url, :jpeg)` instead.
|
|
7
10
|
# Captures a full JPEG screenshot of the webpage under the given url.
|
|
8
11
|
#
|
|
9
12
|
# @param [String] url The url to take a screenshot of.
|
|
@@ -11,9 +14,11 @@ module Dhalang
|
|
|
11
14
|
#
|
|
12
15
|
# @return [String] the screenshot that was taken as binary.
|
|
13
16
|
def self.get_from_url_as_jpeg(url, options = {})
|
|
14
|
-
|
|
17
|
+
warn "[DEPRECATION] `get_from_url_as_jpeg` is deprecated. Use `get_from_url(url, :jpeg)` instead."
|
|
18
|
+
get_from_url(url, :jpeg, options)
|
|
15
19
|
end
|
|
16
20
|
|
|
21
|
+
# <b>DEPRECATED:</b> Please use `get_from_url(url, :png)` instead.
|
|
17
22
|
# Captures a full PNG screenshot of the webpage under the given url.
|
|
18
23
|
#
|
|
19
24
|
# @param [String] url The url to take a screenshot of.
|
|
@@ -21,19 +26,22 @@ module Dhalang
|
|
|
21
26
|
#
|
|
22
27
|
# @return [String] The screenshot that was taken as binary.
|
|
23
28
|
def self.get_from_url_as_png(url, options = {})
|
|
24
|
-
|
|
29
|
+
warn "[DEPRECATION] `get_from_url_as_png` is deprecated. Use `get_from_url(url, :png)` instead."
|
|
30
|
+
get_from_url(url, :png, options)
|
|
25
31
|
end
|
|
26
|
-
|
|
27
|
-
#
|
|
32
|
+
|
|
33
|
+
# Captures ascreenshot of the webpage under the given url.
|
|
28
34
|
#
|
|
29
35
|
# @param [String] url The url to take a screenshot of.
|
|
30
|
-
# @param [String] image_type The image type to use for storing the screenshot.
|
|
31
|
-
# @param [Hash] options
|
|
36
|
+
# @param [String] image_type The image type (JPEG/PNG/WEBP) to use for storing the screenshot.
|
|
37
|
+
# @param [Hash] options User configurable options.
|
|
32
38
|
#
|
|
33
39
|
# @return [String] The screenshot that was taken as binary.
|
|
34
|
-
|
|
40
|
+
def self.get_from_url(url, image_type, options = {})
|
|
35
41
|
UrlUtils.validate(url)
|
|
42
|
+
validate_image_type(image_type)
|
|
36
43
|
validate_options(options)
|
|
44
|
+
|
|
37
45
|
temp_file = FileUtils.create_temp_file(image_type)
|
|
38
46
|
begin
|
|
39
47
|
Puppeteer.visit(url, PUPPETEER_SCRIPT_PATH, temp_file.path, image_type, options)
|
|
@@ -44,6 +52,15 @@ module Dhalang
|
|
|
44
52
|
return binary_image_content
|
|
45
53
|
end
|
|
46
54
|
|
|
55
|
+
# Raises an error if the given image type is not supported.
|
|
56
|
+
#
|
|
57
|
+
# @param [String] image_type The image_type to validate
|
|
58
|
+
private_class_method def self.validate_image_type(image_type)
|
|
59
|
+
if !IMAGE_TYPES.include? image_type.downcase
|
|
60
|
+
raise DhalangError, 'Unsupported image type'
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
47
64
|
# Raises an error if the given options might conflict with the Puppeteer configuration.
|
|
48
65
|
#
|
|
49
66
|
# @param [Hash] options The options to validate
|
data/lib/js/dhalang.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* @typedef {Object} Configuration
|
|
3
5
|
* @property {string} webPageUrl - The url of the webpage to visit.
|
|
@@ -6,7 +8,7 @@
|
|
|
6
8
|
* @property {string} imageType - The type of image to save ( undefined for pdfgenerator ).
|
|
7
9
|
* @property {UserOptions} userOptions - User defined and default parameters to use when navigating to pages.
|
|
8
10
|
* @property {Object} pdfOptions - User defined and default parameters to use when creating PDFs. Note: Do not use directly, rather use {@link getConfiguredPdfOptions}.
|
|
9
|
-
* @property {Object}
|
|
11
|
+
* @property {Object} screenshotOptions - User defined and default parameters to use when creating screenshots.
|
|
10
12
|
* @property {Object} jpegOptions - User defined and default parameters to use when creating JPEGs.
|
|
11
13
|
*/
|
|
12
14
|
|
|
@@ -52,7 +54,7 @@ exports.getConfiguration = function () {
|
|
|
52
54
|
exports.launchPuppeteer = async function (configuration) {
|
|
53
55
|
module.paths.push(configuration.puppeteerPath);
|
|
54
56
|
const puppeteer = require('puppeteer');
|
|
55
|
-
const launchArgs = ['--no-sandbox', '--disable-setuid-sandbox'];
|
|
57
|
+
const launchArgs = ['--no-sandbox', '--disable-setuid-sandbox'].concat(configuration.userOptions.chromeOptions).filter((item, index, self) => self.indexOf(item) === index);
|
|
56
58
|
return await puppeteer.launch({
|
|
57
59
|
args: launchArgs,
|
|
58
60
|
headless: configuration.userOptions.isHeadless
|
|
@@ -107,6 +109,22 @@ exports.navigate = async function (page, configuration) {
|
|
|
107
109
|
exports.getConfiguredPdfOptions = async function (page, configuration) {
|
|
108
110
|
const pdfOptions = configuration.pdfOptions
|
|
109
111
|
|
|
112
|
+
if (pdfOptions['headerTemplateFile'] !== '') {
|
|
113
|
+
try {
|
|
114
|
+
pdfOptions['headerTemplate'] = fs.readFileSync(pdfOptions['headerTemplateFile'], 'utf8')
|
|
115
|
+
} catch(err) {
|
|
116
|
+
// ignoring file related errors
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (pdfOptions['footerTemplateFile'] !== '') {
|
|
121
|
+
try {
|
|
122
|
+
pdfOptions['footerTemplate'] = fs.readFileSync(pdfOptions['footerTemplateFile'], 'utf8')
|
|
123
|
+
} catch(err) {
|
|
124
|
+
// ignoring file related errors
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
110
128
|
if (configuration.userOptions.isAutoHeight === true) {
|
|
111
129
|
const pageHeight = await page.evaluate(() => {
|
|
112
130
|
return Math.max(document.body.scrollHeight, document.body.offsetHeight);
|
|
@@ -116,6 +134,8 @@ exports.getConfiguredPdfOptions = async function (page, configuration) {
|
|
|
116
134
|
}
|
|
117
135
|
}
|
|
118
136
|
|
|
137
|
+
pdfOptions['timeout'] = configuration.userOptions.printToPDFTimeout
|
|
138
|
+
|
|
119
139
|
return pdfOptions
|
|
120
140
|
}
|
|
121
141
|
|
|
@@ -11,13 +11,13 @@ const createScreenshot = async () => {
|
|
|
11
11
|
await dhalang.configure(page, configuration.userOptions);
|
|
12
12
|
await dhalang.navigate(page, configuration);
|
|
13
13
|
|
|
14
|
-
const screenshotOptions = configuration.imageType === "png" ? configuration.pngOptions : configuration.jpegOptions
|
|
15
14
|
await page.screenshot({
|
|
16
15
|
...{
|
|
17
16
|
path: configuration.tempFilePath,
|
|
18
17
|
type: configuration.imageType,
|
|
19
18
|
},
|
|
20
|
-
...
|
|
19
|
+
...(configuration.imageType === "jpeg") && configuration.jpegOptions,
|
|
20
|
+
...configuration.screenshotOptions
|
|
21
21
|
});
|
|
22
22
|
} catch (error) {
|
|
23
23
|
console.error(error.message);
|
data/package-lock.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dhalang",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "dhalang",
|
|
9
|
-
"version": "0.6.
|
|
9
|
+
"version": "0.6.4",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"puppeteer": "^
|
|
12
|
+
"puppeteer": "^13.3.2"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"node_modules/@types/node": {
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g=="
|
|
50
50
|
},
|
|
51
51
|
"node_modules/bl": {
|
|
52
|
-
"version": "4.0
|
|
53
|
-
"resolved": "https://registry.npmjs.org/bl/-/bl-4.0.
|
|
54
|
-
"integrity": "sha512-
|
|
52
|
+
"version": "4.1.0",
|
|
53
|
+
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
|
|
54
|
+
"integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"buffer": "^5.5.0",
|
|
57
57
|
"inherits": "^2.0.4",
|
|
@@ -94,21 +94,34 @@
|
|
|
94
94
|
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
|
95
95
|
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
|
|
96
96
|
},
|
|
97
|
+
"node_modules/cross-fetch": {
|
|
98
|
+
"version": "3.1.5",
|
|
99
|
+
"resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz",
|
|
100
|
+
"integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==",
|
|
101
|
+
"dependencies": {
|
|
102
|
+
"node-fetch": "2.6.7"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
97
105
|
"node_modules/debug": {
|
|
98
|
-
"version": "4.
|
|
99
|
-
"resolved": "https://registry.npmjs.org/debug/-/debug-4.
|
|
100
|
-
"integrity": "sha512
|
|
106
|
+
"version": "4.3.3",
|
|
107
|
+
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz",
|
|
108
|
+
"integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==",
|
|
101
109
|
"dependencies": {
|
|
102
110
|
"ms": "2.1.2"
|
|
103
111
|
},
|
|
104
112
|
"engines": {
|
|
105
113
|
"node": ">=6.0"
|
|
114
|
+
},
|
|
115
|
+
"peerDependenciesMeta": {
|
|
116
|
+
"supports-color": {
|
|
117
|
+
"optional": true
|
|
118
|
+
}
|
|
106
119
|
}
|
|
107
120
|
},
|
|
108
121
|
"node_modules/devtools-protocol": {
|
|
109
|
-
"version": "0.0.
|
|
110
|
-
"resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.
|
|
111
|
-
"integrity": "sha512-
|
|
122
|
+
"version": "0.0.960912",
|
|
123
|
+
"resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.960912.tgz",
|
|
124
|
+
"integrity": "sha512-I3hWmV9rWHbdnUdmMKHF2NuYutIM2kXz2mdXW8ha7TbRlGTVs+PF+PsB5QWvpCek4Fy9B+msiispCfwlhG5Sqg=="
|
|
112
125
|
},
|
|
113
126
|
"node_modules/end-of-stream": {
|
|
114
127
|
"version": "1.4.4",
|
|
@@ -123,7 +136,6 @@
|
|
|
123
136
|
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz",
|
|
124
137
|
"integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==",
|
|
125
138
|
"dependencies": {
|
|
126
|
-
"@types/yauzl": "^2.9.1",
|
|
127
139
|
"debug": "^4.1.1",
|
|
128
140
|
"get-stream": "^5.1.0",
|
|
129
141
|
"yauzl": "^2.10.0"
|
|
@@ -259,11 +271,22 @@
|
|
|
259
271
|
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
|
260
272
|
},
|
|
261
273
|
"node_modules/node-fetch": {
|
|
262
|
-
"version": "2.6.
|
|
263
|
-
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.
|
|
264
|
-
"integrity": "sha512-
|
|
274
|
+
"version": "2.6.7",
|
|
275
|
+
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
|
|
276
|
+
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
|
|
277
|
+
"dependencies": {
|
|
278
|
+
"whatwg-url": "^5.0.0"
|
|
279
|
+
},
|
|
265
280
|
"engines": {
|
|
266
281
|
"node": "4.x || >=6.0.0"
|
|
282
|
+
},
|
|
283
|
+
"peerDependencies": {
|
|
284
|
+
"encoding": "^0.1.0"
|
|
285
|
+
},
|
|
286
|
+
"peerDependenciesMeta": {
|
|
287
|
+
"encoding": {
|
|
288
|
+
"optional": true
|
|
289
|
+
}
|
|
267
290
|
}
|
|
268
291
|
},
|
|
269
292
|
"node_modules/once": {
|
|
@@ -359,23 +382,23 @@
|
|
|
359
382
|
}
|
|
360
383
|
},
|
|
361
384
|
"node_modules/puppeteer": {
|
|
362
|
-
"version": "
|
|
363
|
-
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-
|
|
364
|
-
"integrity": "sha512-
|
|
385
|
+
"version": "13.3.2",
|
|
386
|
+
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-13.3.2.tgz",
|
|
387
|
+
"integrity": "sha512-TIt8/R0eaUwY1c0/O0sCJpSglvGEWVoWFfGZ2dNtxX3eHuBo1ln9abaWfxTjZfsrkYATLSs8oqEdRZpMNnCsvg==",
|
|
365
388
|
"hasInstallScript": true,
|
|
366
389
|
"dependencies": {
|
|
367
|
-
"
|
|
368
|
-
"
|
|
369
|
-
"
|
|
370
|
-
"
|
|
371
|
-
"
|
|
372
|
-
"pkg-dir": "
|
|
373
|
-
"progress": "
|
|
374
|
-
"proxy-from-env": "
|
|
375
|
-
"rimraf": "
|
|
376
|
-
"tar-fs": "
|
|
377
|
-
"unbzip2-stream": "
|
|
378
|
-
"ws": "
|
|
390
|
+
"cross-fetch": "3.1.5",
|
|
391
|
+
"debug": "4.3.3",
|
|
392
|
+
"devtools-protocol": "0.0.960912",
|
|
393
|
+
"extract-zip": "2.0.1",
|
|
394
|
+
"https-proxy-agent": "5.0.0",
|
|
395
|
+
"pkg-dir": "4.2.0",
|
|
396
|
+
"progress": "2.0.3",
|
|
397
|
+
"proxy-from-env": "1.1.0",
|
|
398
|
+
"rimraf": "3.0.2",
|
|
399
|
+
"tar-fs": "2.1.1",
|
|
400
|
+
"unbzip2-stream": "1.4.3",
|
|
401
|
+
"ws": "8.5.0"
|
|
379
402
|
},
|
|
380
403
|
"engines": {
|
|
381
404
|
"node": ">=10.18.1"
|
|
@@ -408,7 +431,21 @@
|
|
|
408
431
|
"node_modules/safe-buffer": {
|
|
409
432
|
"version": "5.2.1",
|
|
410
433
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
|
411
|
-
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
|
|
434
|
+
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
|
435
|
+
"funding": [
|
|
436
|
+
{
|
|
437
|
+
"type": "github",
|
|
438
|
+
"url": "https://github.com/sponsors/feross"
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
"type": "patreon",
|
|
442
|
+
"url": "https://www.patreon.com/feross"
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
"type": "consulting",
|
|
446
|
+
"url": "https://feross.org/support"
|
|
447
|
+
}
|
|
448
|
+
]
|
|
412
449
|
},
|
|
413
450
|
"node_modules/string_decoder": {
|
|
414
451
|
"version": "1.3.0",
|
|
@@ -419,20 +456,20 @@
|
|
|
419
456
|
}
|
|
420
457
|
},
|
|
421
458
|
"node_modules/tar-fs": {
|
|
422
|
-
"version": "2.1.
|
|
423
|
-
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.
|
|
424
|
-
"integrity": "sha512-
|
|
459
|
+
"version": "2.1.1",
|
|
460
|
+
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz",
|
|
461
|
+
"integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==",
|
|
425
462
|
"dependencies": {
|
|
426
463
|
"chownr": "^1.1.1",
|
|
427
464
|
"mkdirp-classic": "^0.5.2",
|
|
428
465
|
"pump": "^3.0.0",
|
|
429
|
-
"tar-stream": "^2.
|
|
466
|
+
"tar-stream": "^2.1.4"
|
|
430
467
|
}
|
|
431
468
|
},
|
|
432
469
|
"node_modules/tar-stream": {
|
|
433
|
-
"version": "2.
|
|
434
|
-
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.
|
|
435
|
-
"integrity": "sha512-
|
|
470
|
+
"version": "2.2.0",
|
|
471
|
+
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz",
|
|
472
|
+
"integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
|
|
436
473
|
"dependencies": {
|
|
437
474
|
"bl": "^4.0.3",
|
|
438
475
|
"end-of-stream": "^1.4.1",
|
|
@@ -449,6 +486,11 @@
|
|
|
449
486
|
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
|
|
450
487
|
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
|
|
451
488
|
},
|
|
489
|
+
"node_modules/tr46": {
|
|
490
|
+
"version": "0.0.3",
|
|
491
|
+
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
|
492
|
+
"integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
|
|
493
|
+
},
|
|
452
494
|
"node_modules/unbzip2-stream": {
|
|
453
495
|
"version": "1.4.3",
|
|
454
496
|
"resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz",
|
|
@@ -463,17 +505,43 @@
|
|
|
463
505
|
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
|
464
506
|
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
|
465
507
|
},
|
|
508
|
+
"node_modules/webidl-conversions": {
|
|
509
|
+
"version": "3.0.1",
|
|
510
|
+
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
|
511
|
+
"integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
|
|
512
|
+
},
|
|
513
|
+
"node_modules/whatwg-url": {
|
|
514
|
+
"version": "5.0.0",
|
|
515
|
+
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
|
516
|
+
"integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=",
|
|
517
|
+
"dependencies": {
|
|
518
|
+
"tr46": "~0.0.3",
|
|
519
|
+
"webidl-conversions": "^3.0.0"
|
|
520
|
+
}
|
|
521
|
+
},
|
|
466
522
|
"node_modules/wrappy": {
|
|
467
523
|
"version": "1.0.2",
|
|
468
524
|
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
|
469
525
|
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
|
470
526
|
},
|
|
471
527
|
"node_modules/ws": {
|
|
472
|
-
"version": "
|
|
473
|
-
"resolved": "https://registry.npmjs.org/ws/-/ws-
|
|
474
|
-
"integrity": "sha512-
|
|
528
|
+
"version": "8.5.0",
|
|
529
|
+
"resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz",
|
|
530
|
+
"integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==",
|
|
475
531
|
"engines": {
|
|
476
|
-
"node": ">=
|
|
532
|
+
"node": ">=10.0.0"
|
|
533
|
+
},
|
|
534
|
+
"peerDependencies": {
|
|
535
|
+
"bufferutil": "^4.0.1",
|
|
536
|
+
"utf-8-validate": "^5.0.2"
|
|
537
|
+
},
|
|
538
|
+
"peerDependenciesMeta": {
|
|
539
|
+
"bufferutil": {
|
|
540
|
+
"optional": true
|
|
541
|
+
},
|
|
542
|
+
"utf-8-validate": {
|
|
543
|
+
"optional": true
|
|
544
|
+
}
|
|
477
545
|
}
|
|
478
546
|
},
|
|
479
547
|
"node_modules/yauzl": {
|
|
@@ -521,9 +589,9 @@
|
|
|
521
589
|
"integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g=="
|
|
522
590
|
},
|
|
523
591
|
"bl": {
|
|
524
|
-
"version": "4.0
|
|
525
|
-
"resolved": "https://registry.npmjs.org/bl/-/bl-4.0.
|
|
526
|
-
"integrity": "sha512-
|
|
592
|
+
"version": "4.1.0",
|
|
593
|
+
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
|
|
594
|
+
"integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
|
|
527
595
|
"requires": {
|
|
528
596
|
"buffer": "^5.5.0",
|
|
529
597
|
"inherits": "^2.0.4",
|
|
@@ -563,18 +631,26 @@
|
|
|
563
631
|
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
|
564
632
|
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
|
|
565
633
|
},
|
|
634
|
+
"cross-fetch": {
|
|
635
|
+
"version": "3.1.5",
|
|
636
|
+
"resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz",
|
|
637
|
+
"integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==",
|
|
638
|
+
"requires": {
|
|
639
|
+
"node-fetch": "2.6.7"
|
|
640
|
+
}
|
|
641
|
+
},
|
|
566
642
|
"debug": {
|
|
567
|
-
"version": "4.
|
|
568
|
-
"resolved": "https://registry.npmjs.org/debug/-/debug-4.
|
|
569
|
-
"integrity": "sha512
|
|
643
|
+
"version": "4.3.3",
|
|
644
|
+
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz",
|
|
645
|
+
"integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==",
|
|
570
646
|
"requires": {
|
|
571
647
|
"ms": "2.1.2"
|
|
572
648
|
}
|
|
573
649
|
},
|
|
574
650
|
"devtools-protocol": {
|
|
575
|
-
"version": "0.0.
|
|
576
|
-
"resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.
|
|
577
|
-
"integrity": "sha512-
|
|
651
|
+
"version": "0.0.960912",
|
|
652
|
+
"resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.960912.tgz",
|
|
653
|
+
"integrity": "sha512-I3hWmV9rWHbdnUdmMKHF2NuYutIM2kXz2mdXW8ha7TbRlGTVs+PF+PsB5QWvpCek4Fy9B+msiispCfwlhG5Sqg=="
|
|
578
654
|
},
|
|
579
655
|
"end-of-stream": {
|
|
580
656
|
"version": "1.4.4",
|
|
@@ -698,9 +774,12 @@
|
|
|
698
774
|
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
|
699
775
|
},
|
|
700
776
|
"node-fetch": {
|
|
701
|
-
"version": "2.6.
|
|
702
|
-
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.
|
|
703
|
-
"integrity": "sha512-
|
|
777
|
+
"version": "2.6.7",
|
|
778
|
+
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
|
|
779
|
+
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
|
|
780
|
+
"requires": {
|
|
781
|
+
"whatwg-url": "^5.0.0"
|
|
782
|
+
}
|
|
704
783
|
},
|
|
705
784
|
"once": {
|
|
706
785
|
"version": "1.4.0",
|
|
@@ -774,22 +853,22 @@
|
|
|
774
853
|
}
|
|
775
854
|
},
|
|
776
855
|
"puppeteer": {
|
|
777
|
-
"version": "
|
|
778
|
-
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-
|
|
779
|
-
"integrity": "sha512-
|
|
780
|
-
"requires": {
|
|
781
|
-
"
|
|
782
|
-
"
|
|
783
|
-
"
|
|
784
|
-
"
|
|
785
|
-
"
|
|
786
|
-
"pkg-dir": "
|
|
787
|
-
"progress": "
|
|
788
|
-
"proxy-from-env": "
|
|
789
|
-
"rimraf": "
|
|
790
|
-
"tar-fs": "
|
|
791
|
-
"unbzip2-stream": "
|
|
792
|
-
"ws": "
|
|
856
|
+
"version": "13.3.2",
|
|
857
|
+
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-13.3.2.tgz",
|
|
858
|
+
"integrity": "sha512-TIt8/R0eaUwY1c0/O0sCJpSglvGEWVoWFfGZ2dNtxX3eHuBo1ln9abaWfxTjZfsrkYATLSs8oqEdRZpMNnCsvg==",
|
|
859
|
+
"requires": {
|
|
860
|
+
"cross-fetch": "3.1.5",
|
|
861
|
+
"debug": "4.3.3",
|
|
862
|
+
"devtools-protocol": "0.0.960912",
|
|
863
|
+
"extract-zip": "2.0.1",
|
|
864
|
+
"https-proxy-agent": "5.0.0",
|
|
865
|
+
"pkg-dir": "4.2.0",
|
|
866
|
+
"progress": "2.0.3",
|
|
867
|
+
"proxy-from-env": "1.1.0",
|
|
868
|
+
"rimraf": "3.0.2",
|
|
869
|
+
"tar-fs": "2.1.1",
|
|
870
|
+
"unbzip2-stream": "1.4.3",
|
|
871
|
+
"ws": "8.5.0"
|
|
793
872
|
}
|
|
794
873
|
},
|
|
795
874
|
"readable-stream": {
|
|
@@ -824,20 +903,20 @@
|
|
|
824
903
|
}
|
|
825
904
|
},
|
|
826
905
|
"tar-fs": {
|
|
827
|
-
"version": "2.1.
|
|
828
|
-
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.
|
|
829
|
-
"integrity": "sha512-
|
|
906
|
+
"version": "2.1.1",
|
|
907
|
+
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz",
|
|
908
|
+
"integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==",
|
|
830
909
|
"requires": {
|
|
831
910
|
"chownr": "^1.1.1",
|
|
832
911
|
"mkdirp-classic": "^0.5.2",
|
|
833
912
|
"pump": "^3.0.0",
|
|
834
|
-
"tar-stream": "^2.
|
|
913
|
+
"tar-stream": "^2.1.4"
|
|
835
914
|
}
|
|
836
915
|
},
|
|
837
916
|
"tar-stream": {
|
|
838
|
-
"version": "2.
|
|
839
|
-
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.
|
|
840
|
-
"integrity": "sha512-
|
|
917
|
+
"version": "2.2.0",
|
|
918
|
+
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz",
|
|
919
|
+
"integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
|
|
841
920
|
"requires": {
|
|
842
921
|
"bl": "^4.0.3",
|
|
843
922
|
"end-of-stream": "^1.4.1",
|
|
@@ -851,6 +930,11 @@
|
|
|
851
930
|
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
|
|
852
931
|
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
|
|
853
932
|
},
|
|
933
|
+
"tr46": {
|
|
934
|
+
"version": "0.0.3",
|
|
935
|
+
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
|
936
|
+
"integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
|
|
937
|
+
},
|
|
854
938
|
"unbzip2-stream": {
|
|
855
939
|
"version": "1.4.3",
|
|
856
940
|
"resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz",
|
|
@@ -865,15 +949,30 @@
|
|
|
865
949
|
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
|
866
950
|
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
|
867
951
|
},
|
|
952
|
+
"webidl-conversions": {
|
|
953
|
+
"version": "3.0.1",
|
|
954
|
+
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
|
955
|
+
"integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
|
|
956
|
+
},
|
|
957
|
+
"whatwg-url": {
|
|
958
|
+
"version": "5.0.0",
|
|
959
|
+
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
|
960
|
+
"integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=",
|
|
961
|
+
"requires": {
|
|
962
|
+
"tr46": "~0.0.3",
|
|
963
|
+
"webidl-conversions": "^3.0.0"
|
|
964
|
+
}
|
|
965
|
+
},
|
|
868
966
|
"wrappy": {
|
|
869
967
|
"version": "1.0.2",
|
|
870
968
|
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
|
871
969
|
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
|
872
970
|
},
|
|
873
971
|
"ws": {
|
|
874
|
-
"version": "
|
|
875
|
-
"resolved": "https://registry.npmjs.org/ws/-/ws-
|
|
876
|
-
"integrity": "sha512-
|
|
972
|
+
"version": "8.5.0",
|
|
973
|
+
"resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz",
|
|
974
|
+
"integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==",
|
|
975
|
+
"requires": {}
|
|
877
976
|
},
|
|
878
977
|
"yauzl": {
|
|
879
978
|
"version": "2.10.0",
|
data/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dhalang",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"directories": {
|
|
@@ -20,6 +20,6 @@
|
|
|
20
20
|
},
|
|
21
21
|
"homepage": "https://github.com/NielsSteensma/Dhalang#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"puppeteer": "^
|
|
23
|
+
"puppeteer": "^13.3.2"
|
|
24
24
|
}
|
|
25
25
|
}
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: Dhalang
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Niels Steensma
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-06-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -16,70 +16,70 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 2.3.6
|
|
20
20
|
type: :development
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
26
|
+
version: 2.3.6
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
28
|
+
name: fastimage
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
33
|
+
version: 2.2.6
|
|
34
34
|
type: :development
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
40
|
+
version: 2.2.6
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
42
|
+
name: pdf-reader
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version:
|
|
47
|
+
version: 2.9.0
|
|
48
48
|
type: :development
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version:
|
|
54
|
+
version: 2.9.0
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
56
|
+
name: rake
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
59
|
- - "~>"
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version:
|
|
61
|
+
version: 13.0.6
|
|
62
62
|
type: :development
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
66
|
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version:
|
|
68
|
+
version: 13.0.6
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
|
-
name:
|
|
70
|
+
name: rspec
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
|
73
73
|
- - "~>"
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '
|
|
75
|
+
version: '3.0'
|
|
76
76
|
type: :development
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
80
|
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: '
|
|
82
|
+
version: '3.0'
|
|
83
83
|
description:
|
|
84
84
|
email:
|
|
85
85
|
- nielssteensma@yahoo.nl
|
|
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
127
127
|
- !ruby/object:Gem::Version
|
|
128
128
|
version: '0'
|
|
129
129
|
requirements: []
|
|
130
|
-
rubygems_version: 3.0.
|
|
130
|
+
rubygems_version: 3.0.8
|
|
131
131
|
signing_key:
|
|
132
132
|
specification_version: 4
|
|
133
133
|
summary: Ruby wrapper for Puppeteer. Generate screenshots and PDF's from HTML!
|