muhammara 3.0.0 → 3.1.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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.1.1] - 2022-10-23
11
+
12
+ ### Fixed
13
+
14
+ - NPE in parser when file ends before it really starts
15
+
16
+ ## [3.1.0] - 2022-09-30
17
+
18
+ ### Changed
19
+
20
+ - Update TypeScript declaration for `PDFStreamForResponse` to accept any writable stream as an argument, not just `PDFRStreamForFile`
21
+
22
+ ### Added
23
+
24
+ - Node 18
25
+ - Electron 20.0, 20.1, 20.2
26
+ - Prettier as dev dependency and basics
27
+ - Electron 19.1
28
+
10
29
  ## [3.0.0] - 2022-07-19
11
30
 
12
31
  ### Fixed
@@ -16,9 +35,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
16
35
  ### Added
17
36
 
18
37
  - drawPath can now be used differently and this new way can be described with ts.
19
- The old style is `drawPath(x1, y1, x2, y2..., options)` we now allow `drawPath([[x1, y1], [x2, y2]...], options)` too
38
+ The old style is `drawPath(x1, y1, x2, y2..., options)` we now allow `drawPath([[x1, y1], [x2, y2]...], options)` too
20
39
  - scn and SCN can now be used differently and this new way can be described with ts.
21
- The old style is `scn(c1, c2, c3, c4, ..., 'patternName')` we now allow `scn([[c1, c2, c3, c4, ...], 'patternName')` too
40
+ The old style is `scn(c1, c2, c3, c4, ..., 'patternName')` we now allow `scn([[c1, c2, c3, c4, ...], 'patternName')` too
22
41
 
23
42
  ### Changed
24
43
 
@@ -91,7 +110,7 @@ The old style is `drawPath(x1, y1, x2, y2..., options)` we now allow `drawPath([
91
110
  ### Added
92
111
 
93
112
  - Add Electron 13.3.0
94
- - Documentation (copy of the wiki)
113
+ - Documentation (copy of the wiki)
95
114
  - Add Electron 13.2.3
96
115
  - Add Electron 13.5.0
97
116
  - Add Electron 14.0.1
@@ -115,8 +134,8 @@ The old style is `drawPath(x1, y1, x2, y2..., options)` we now allow `drawPath([
115
134
 
116
135
  ### Fixed
117
136
 
118
- * Yarn v2 incompatibiliy
119
- * Build issues on mac OS big sur
137
+ - Yarn v2 incompatibiliy
138
+ - Build issues on mac OS big sur
120
139
 
121
140
  ## [1.8.0] - 2021-05-28
122
141
 
@@ -131,56 +150,56 @@ The old style is `drawPath(x1, y1, x2, y2..., options)` we now allow `drawPath([
131
150
 
132
151
  ### Added
133
152
 
134
- * More electron 11.x releases
135
- * Add electron 12.0.0
136
- * Add electron 10.2, 10.3
137
- * Add electron 9.4, 9.3
153
+ - More electron 11.x releases
154
+ - Add electron 12.0.0
155
+ - Add electron 10.2, 10.3
156
+ - Add electron 9.4, 9.3
138
157
 
139
158
  ## [1.6.0] - 2021-02-17
140
159
 
141
160
  ### Fixed
142
161
 
143
- * Update the g++ compiler from 4.8 to 5.4 (default on xenial) for linux builds
144
- * Changed builds from travis and app veyor to github
162
+ - Update the g++ compiler from 4.8 to 5.4 (default on xenial) for linux builds
163
+ - Changed builds from travis and app veyor to github
145
164
 
146
165
  ### Added
147
166
 
148
- * Electron 11
149
- * Added Node 15
167
+ - Electron 11
168
+ - Added Node 15
150
169
 
151
170
  ## [1.5.1] - 2020-10-10
152
171
 
153
172
  ### Added
154
173
 
155
- * Added manual workflow to reduce release errors
174
+ - Added manual workflow to reduce release errors
156
175
 
157
176
  ### Fixed
158
177
 
159
- * Huge package size as npm publish does not use .gitignore or .npmignore locally
178
+ - Huge package size as npm publish does not use .gitignore or .npmignore locally
160
179
 
161
180
  ## [1.5.0] - 2020-10-10
162
181
 
163
182
  ### Added
164
183
 
165
- * Electron 7.3, 8.3, 8.4, 8.5 and 9.3
184
+ - Electron 7.3, 8.3, 8.4, 8.5 and 9.3
166
185
 
167
186
  ## [1.4.3] - 2020-10-09
168
187
 
169
188
  ### Fixed
170
189
 
171
- * Return code fixed for builds on app veyor.
172
- * Winwdows builds successfully with electron 10.x
173
- * NPM version on app veyor fixed to build electron 2.x again
190
+ - Return code fixed for builds on app veyor.
191
+ - Winwdows builds successfully with electron 10.x
192
+ - NPM version on app veyor fixed to build electron 2.x again
174
193
 
175
194
  ### Added
176
195
 
177
- * Add electron 10.1.3
196
+ - Add electron 10.1.3
178
197
 
179
198
  ## [1.4.2] - 2020-08-27
180
199
 
181
200
  ### Added
182
201
 
183
- * Add electron 10.0
202
+ - Add electron 10.0
184
203
 
185
204
  ## [1.4.1] - 2020-08-13
186
205
 
@@ -190,56 +209,55 @@ debug output.
190
209
 
191
210
  ### Fixed
192
211
 
193
- * Removed debug output from packaged dependency `node-pre-gyp`
194
-
212
+ - Removed debug output from packaged dependency `node-pre-gyp`
195
213
 
196
214
  ## [1.4.0] - 2020-08-10
197
215
 
198
216
  ### Added
199
217
 
200
- * Add electron 9.2
218
+ - Add electron 9.2
201
219
 
202
220
  ## [1.3.0] - 2020-08-06
203
221
 
204
222
  ### Added
205
223
 
206
- * Add electron-9.1 pre built
224
+ - Add electron-9.1 pre built
207
225
 
208
226
  ### Fixed
209
227
 
210
- * Add missing typescript declaration files to published packages
228
+ - Add missing typescript declaration files to published packages
211
229
 
212
230
  ## [1.2.0] - 2020-06-01
213
231
 
214
232
  ### Fixed
215
233
 
216
- * Updated freetype to 2.10.0
217
- * Updated libpng dependency to 1.6.37
218
- * Updated libaesgm dependency
219
- * Update libjpeg dependency to 9d
220
- * Updated libtiff dependency to 3.9.7
234
+ - Updated freetype to 2.10.0
235
+ - Updated libpng dependency to 1.6.37
236
+ - Updated libaesgm dependency
237
+ - Update libjpeg dependency to 9d
238
+ - Updated libtiff dependency to 3.9.7
221
239
 
222
240
  ## [1.1.0] - 2020-05-27
223
241
 
224
242
  ### Added
225
243
 
226
- * Added infos about being hummusjs drop in replacement
227
- * Added electron v9.0.0
244
+ - Added infos about being hummusjs drop in replacement
245
+ - Added electron v9.0.0
228
246
 
229
247
  ### Fixed
230
248
 
231
- * Updated dependencies and dev dependencies
249
+ - Updated dependencies and dev dependencies
232
250
 
233
251
  ## [1.0.1] - 2020-05-08
234
252
 
235
253
  ### Fixed
236
254
 
237
- * Fixed readme to include infos about muhammaraJS and hummus
238
- * Fixed node-pre-gyp binary download links
255
+ - Fixed readme to include infos about muhammaraJS and hummus
256
+ - Fixed node-pre-gyp binary download links
239
257
 
240
258
  ### Removed
241
259
 
242
- * Unecessary dependency on aws-sdk
260
+ - Unecessary dependency on aws-sdk
243
261
 
244
262
  ## [1.0.0] - 2020-05-07
245
263
 
@@ -248,22 +266,23 @@ with the following changes.
248
266
 
249
267
  ### Added
250
268
 
251
- * Store releases @github
252
- * Listen for tags instead of a commit message
253
- * Added node v13, v14, electron 6.1, 7.1, 7.2, 8.0, 8.1, 8.2
269
+ - Store releases @github
270
+ - Listen for tags instead of a commit message
271
+ - Added node v13, v14, electron 6.1, 7.1, 7.2, 8.0, 8.1, 8.2
254
272
 
255
273
  ### Fixed
256
274
 
257
- * Updated v8:GET / v8:SET calls which are incompatible with newer node version (>13)
275
+ - Updated v8:GET / v8:SET calls which are incompatible with newer node version (>13)
258
276
 
259
277
  ### Removed
260
278
 
261
- * Dropped support for electron 1.8
262
-
279
+ - Dropped support for electron 1.8
263
280
 
264
- * Initial release
281
+ - Initial release
265
282
 
266
- [Unreleased]: https://github.com/julianhille/MuhammaraJS/compare/3.0.0...HEAD
283
+ [unreleased]: https://github.com/julianhille/MuhammaraJS/compare/3.1.1...HEAD
284
+ [3.1.1]: https://github.com/julianhille/MuhammaraJS/compare/3.1.0...3.1.1
285
+ [3.1.0]: https://github.com/julianhille/MuhammaraJS/compare/3.0.0...3.1.0
267
286
  [3.0.0]: https://github.com/julianhille/MuhammaraJS/compare/2.6.0...3.0.0
268
287
  [2.6.0]: https://github.com/julianhille/MuhammaraJS/compare/2.5.0...2.6.0
269
288
  [2.5.0]: https://github.com/julianhille/MuhammaraJS/compare/2.4.0...2.5.0
@@ -4,38 +4,40 @@
4
4
  @author Luciano Júnior
5
5
  */
6
6
 
7
- function PDFRStreamForBuffer(buffer){
8
- this.innerArray = Array.prototype.slice.call(buffer, 0);
9
- this.rposition = 0;
10
- this.fileSize = this.innerArray.length;
11
- }
12
-
13
- PDFRStreamForBuffer.prototype.read = function(inAmount){
14
- var amountToRead = inAmount;
15
- var arr = this.innerArray.slice(this.rposition,this.rposition+amountToRead);
16
- this.rposition += amountToRead;
17
- return arr;
18
- }
19
-
20
- PDFRStreamForBuffer.prototype.notEnded = function(){
21
- return this.rposition < this.fileSize;
22
- }
23
-
24
- PDFRStreamForBuffer.prototype.setPosition = function(inPosition){
25
- this.rposition = inPosition;
26
- }
27
-
28
- PDFRStreamForBuffer.prototype.setPositionFromEnd = function(inPosition){
29
- this.rposition = this.fileSize-inPosition;
30
- }
31
-
32
- PDFRStreamForBuffer.prototype.skip = function(inAmount){
33
- this.rposition += inAmount;
34
- }
35
-
36
- PDFRStreamForBuffer.prototype.getCurrentPosition = function(){
37
- return this.rposition;
7
+ function PDFRStreamForBuffer(buffer) {
8
+ this.innerArray = Array.prototype.slice.call(buffer, 0);
9
+ this.rposition = 0;
10
+ this.fileSize = this.innerArray.length;
38
11
  }
39
12
 
13
+ PDFRStreamForBuffer.prototype.read = function (inAmount) {
14
+ var amountToRead = inAmount;
15
+ var arr = this.innerArray.slice(
16
+ this.rposition,
17
+ this.rposition + amountToRead
18
+ );
19
+ this.rposition += amountToRead;
20
+ return arr;
21
+ };
22
+
23
+ PDFRStreamForBuffer.prototype.notEnded = function () {
24
+ return this.rposition < this.fileSize;
25
+ };
26
+
27
+ PDFRStreamForBuffer.prototype.setPosition = function (inPosition) {
28
+ this.rposition = inPosition;
29
+ };
30
+
31
+ PDFRStreamForBuffer.prototype.setPositionFromEnd = function (inPosition) {
32
+ this.rposition = this.fileSize - inPosition;
33
+ };
34
+
35
+ PDFRStreamForBuffer.prototype.skip = function (inAmount) {
36
+ this.rposition += inAmount;
37
+ };
38
+
39
+ PDFRStreamForBuffer.prototype.getCurrentPosition = function () {
40
+ return this.rposition;
41
+ };
40
42
 
41
43
  module.exports = PDFRStreamForBuffer;
@@ -1,58 +1,49 @@
1
- var fs = require('fs');
1
+ var fs = require("fs");
2
2
  /*
3
3
  PDFRStreamForFile is an implementation of a read stream using the supplied file path.
4
4
  */
5
5
 
6
- function PDFRStreamForFile(inPath)
7
- {
8
- this.rs = fs.openSync(inPath,'r');
9
- this.path = inPath;
10
- this.rposition = 0;
11
- this.fileSize = fs.statSync(inPath)["size"];
6
+ function PDFRStreamForFile(inPath) {
7
+ this.rs = fs.openSync(inPath, "r");
8
+ this.path = inPath;
9
+ this.rposition = 0;
10
+ this.fileSize = fs.statSync(inPath)["size"];
12
11
  }
13
12
 
14
- PDFRStreamForFile.prototype.read = function(inAmount)
15
- {
16
- var buffer = new Buffer(inAmount*2);
17
- var bytesRead = fs.readSync(this.rs, buffer, 0, inAmount,this.rposition);
18
- var arr = [];
13
+ PDFRStreamForFile.prototype.read = function (inAmount) {
14
+ var buffer = new Buffer(inAmount * 2);
15
+ var bytesRead = fs.readSync(this.rs, buffer, 0, inAmount, this.rposition);
16
+ var arr = [];
19
17
 
20
- for(var i=0;i<bytesRead;++i)
21
- arr.push(buffer[i]);
22
- this.rposition+=bytesRead;
23
- return arr;
24
- }
18
+ for (var i = 0; i < bytesRead; ++i) arr.push(buffer[i]);
19
+ this.rposition += bytesRead;
20
+ return arr;
21
+ };
25
22
 
26
- PDFRStreamForFile.prototype.notEnded = function()
27
- {
28
- return this.rposition < this.fileSize;
29
- }
23
+ PDFRStreamForFile.prototype.notEnded = function () {
24
+ return this.rposition < this.fileSize;
25
+ };
30
26
 
31
- PDFRStreamForFile.prototype.setPosition = function(inPosition)
32
- {
33
- this.rposition = inPosition;
34
- }
27
+ PDFRStreamForFile.prototype.setPosition = function (inPosition) {
28
+ this.rposition = inPosition;
29
+ };
35
30
 
36
- PDFRStreamForFile.prototype.setPositionFromEnd = function(inPosition)
37
- {
38
- this.rposition = this.fileSize-inPosition;
39
- }
31
+ PDFRStreamForFile.prototype.setPositionFromEnd = function (inPosition) {
32
+ this.rposition = this.fileSize - inPosition;
33
+ };
40
34
 
41
- PDFRStreamForFile.prototype.skip = function(inAmount)
42
- {
43
- this.rposition += inAmount;
44
- }
35
+ PDFRStreamForFile.prototype.skip = function (inAmount) {
36
+ this.rposition += inAmount;
37
+ };
45
38
 
46
- PDFRStreamForFile.prototype.getCurrentPosition = function()
47
- {
48
- return this.rposition;
49
- }
39
+ PDFRStreamForFile.prototype.getCurrentPosition = function () {
40
+ return this.rposition;
41
+ };
50
42
 
51
43
  function noop() {}
52
44
 
53
- PDFRStreamForFile.prototype.close = function(inCallback)
54
- {
55
- fs.close(this.rs,inCallback ? inCallback : noop);
45
+ PDFRStreamForFile.prototype.close = function (inCallback) {
46
+ fs.close(this.rs, inCallback ? inCallback : noop);
56
47
  };
57
48
 
58
- module.exports = PDFRStreamForFile;
49
+ module.exports = PDFRStreamForFile;
@@ -2,28 +2,21 @@
2
2
  PDFStreamForResponse is an implementation of a write stream that writes directly to an HTTP response.
3
3
  Using this stream frees the user from having to create a PDF file on disk when generating on-demand PDFs
4
4
  */
5
- function PDFStreamForResponse(inResponse)
6
- {
7
- this.response = inResponse;
8
- this.position = 0;
5
+ function PDFStreamForResponse(inResponse) {
6
+ this.response = inResponse;
7
+ this.position = 0;
9
8
  }
10
9
 
11
- PDFStreamForResponse.prototype.write = function(inBytesArray)
12
- {
13
- if(inBytesArray.length > 0)
14
- {
15
- this.response.write(new Buffer(inBytesArray));
16
- this.position+=inBytesArray.length;
17
- return inBytesArray.length;
18
- }
19
- else
20
- return 0;
10
+ PDFStreamForResponse.prototype.write = function (inBytesArray) {
11
+ if (inBytesArray.length > 0) {
12
+ this.response.write(new Buffer(inBytesArray));
13
+ this.position += inBytesArray.length;
14
+ return inBytesArray.length;
15
+ } else return 0;
21
16
  };
22
17
 
23
-
24
- PDFStreamForResponse.prototype.getCurrentPosition = function()
25
- {
26
- return this.position;
18
+ PDFStreamForResponse.prototype.getCurrentPosition = function () {
19
+ return this.position;
27
20
  };
28
21
 
29
- module.exports = PDFStreamForResponse;
22
+ module.exports = PDFStreamForResponse;
@@ -1,32 +1,25 @@
1
- function PDFWStreamForBuffer()
2
- {
3
- this.buffer = null;
4
- this.position = 0;
1
+ function PDFWStreamForBuffer() {
2
+ this.buffer = null;
3
+ this.position = 0;
5
4
  }
6
5
 
7
- PDFWStreamForBuffer.prototype.write = function(inBytesArray)
8
- {
9
- if(inBytesArray.length > 0)
10
- {
11
- if(!this.buffer)
12
- {
13
- this.buffer = Buffer.from(inBytesArray);
14
- }
15
- else
16
- {
17
- this.buffer = Buffer.concat([this.buffer, Buffer.from(inBytesArray)]);
18
- }
19
-
20
- this.position += inBytesArray.length;
21
- return inBytesArray.length;
6
+ PDFWStreamForBuffer.prototype.write = function (inBytesArray) {
7
+ if (inBytesArray.length > 0) {
8
+ if (!this.buffer) {
9
+ this.buffer = Buffer.from(inBytesArray);
10
+ } else {
11
+ this.buffer = Buffer.concat([this.buffer, Buffer.from(inBytesArray)]);
22
12
  }
23
13
 
24
- return 0;
14
+ this.position += inBytesArray.length;
15
+ return inBytesArray.length;
16
+ }
17
+
18
+ return 0;
25
19
  };
26
20
 
27
- PDFWStreamForBuffer.prototype.getCurrentPosition = function()
28
- {
29
- return this.position;
21
+ PDFWStreamForBuffer.prototype.getCurrentPosition = function () {
22
+ return this.position;
30
23
  };
31
24
 
32
25
  module.exports = PDFWStreamForBuffer;
@@ -1,51 +1,38 @@
1
- var fs = require('fs');
1
+ var fs = require("fs");
2
2
 
3
3
  /*
4
4
  PDFWStreamForFile is an implementation of a write stream using the supplied file path.
5
5
  */
6
6
 
7
- function PDFWStreamForFile(inPath)
8
- {
9
- this.ws = fs.createWriteStream(inPath);
10
- this.position = 0;
11
- this.path = inPath;
7
+ function PDFWStreamForFile(inPath) {
8
+ this.ws = fs.createWriteStream(inPath);
9
+ this.position = 0;
10
+ this.path = inPath;
12
11
  }
13
12
 
14
- PDFWStreamForFile.prototype.write = function(inBytesArray)
15
- {
16
- if(inBytesArray.length > 0)
17
- {
18
- this.ws.write(new Buffer(inBytesArray));
19
- this.position+=inBytesArray.length;
20
- return inBytesArray.length;
21
- }
22
- else
23
- return 0;
13
+ PDFWStreamForFile.prototype.write = function (inBytesArray) {
14
+ if (inBytesArray.length > 0) {
15
+ this.ws.write(new Buffer(inBytesArray));
16
+ this.position += inBytesArray.length;
17
+ return inBytesArray.length;
18
+ } else return 0;
24
19
  };
25
20
 
26
- PDFWStreamForFile.prototype.getCurrentPosition = function()
27
- {
28
- return this.position;
21
+ PDFWStreamForFile.prototype.getCurrentPosition = function () {
22
+ return this.position;
29
23
  };
30
24
 
31
- PDFWStreamForFile.prototype.close = function(inCallback)
32
- {
33
- if(this.ws)
34
- {
35
- var self = this;
25
+ PDFWStreamForFile.prototype.close = function (inCallback) {
26
+ if (this.ws) {
27
+ var self = this;
36
28
 
37
- this.ws.end(function()
38
- {
39
- self.ws = null;
40
- if(inCallback)
41
- inCallback();
42
- })
43
- }
44
- else
45
- {
46
- if(inCallback)
47
- inCallback();
48
- }
29
+ this.ws.end(function () {
30
+ self.ws = null;
31
+ if (inCallback) inCallback();
32
+ });
33
+ } else {
34
+ if (inCallback) inCallback();
35
+ }
49
36
  };
50
37
 
51
- module.exports = PDFWStreamForFile;
38
+ module.exports = PDFWStreamForFile;
package/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # Welcome to MuhammaraJS
2
+
2
3
  [![NPM version](http://img.shields.io/npm/v/muhammara.svg?style=flat)](https://www.npmjs.org/package/muhammara)
3
4
  [![Build status](https://github.com/julianhille/MuhammaraJS/actions/workflows/build.yml/badge.svg?branch=develop)](https://github.com/julianhille/MuhammaraJS/actions/workflows/build.yml)
4
5
 
@@ -11,7 +12,6 @@ hummusJS github wiki: available [here](https://github.com/galkahana/HummusJS/wik
11
12
  Welcome to HummusJS.
12
13
  A Fast NodeJS Module for Creating, Parsing an Manipulating PDF Files and Streams.
13
14
 
14
-
15
15
  Original Project
16
16
  Project site is [here](http://www.pdfhummus.com).
17
17
 
package/binding.gyp CHANGED
@@ -7,15 +7,28 @@
7
7
  'dependencies': [
8
8
  './src/deps/PDFWriter/binding.gyp:pdfwriter'
9
9
  ],
10
+ "cflags_cc": [ "-std=c++17" ],
11
+ "cflags": [ "-std=c++17" ],
10
12
  'include_dirs': [
11
13
  './src',
12
14
  './src/deps/PDFWriter',
13
15
  './src/deps/FreeType/include'
14
16
  ],
17
+ 'msvs-settings':
18
+ {
19
+ 'VCCLCompilerTool':
20
+ {
21
+ 'AdditionalOptions':
22
+ [
23
+ '-std:c++17',
24
+ ]
25
+ }
26
+ },
15
27
  'conditions': [
16
28
  ['OS=="mac"', {
17
29
  'xcode_settings': {
18
- 'CLANG_CXX_LIBRARY': 'libc++'
30
+ 'CLANG_CXX_LIBRARY': 'libc++',
31
+ "OTHER_CFLAGS": [ "-std=c++17"]
19
32
  }
20
33
  }],
21
34
  ['OS=="win"', {