muhammara 4.0.0 → 4.1.0
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 +24 -1
- package/lib/PDFRStreamForBuffer.js +4 -5
- package/lib/recipe/annotation.js +47 -13
- package/lib/recipe/font.js +2 -0
- package/lib/recipe/page.js +3 -0
- package/lib/recipe/text.js +18 -0
- package/muhammara.d.ts +48 -7
- package/node_modules/@mapbox/node-pre-gyp/.github/workflows/codeql.yml +74 -0
- package/node_modules/@mapbox/node-pre-gyp/CHANGELOG.md +3 -0
- package/node_modules/@mapbox/node-pre-gyp/package.json +5 -5
- package/node_modules/balanced-match/package.json +2 -1
- package/node_modules/brace-expansion/package.json +1 -1
- package/node_modules/debug/package.json +2 -1
- package/node_modules/detect-libc/README.md +4 -1
- package/node_modules/detect-libc/index.d.ts +3 -0
- package/node_modules/detect-libc/lib/detect-libc.js +105 -4
- package/node_modules/detect-libc/lib/filesystem.js +41 -0
- package/node_modules/detect-libc/lib/process.js +3 -0
- package/node_modules/detect-libc/package.json +12 -5
- package/node_modules/node-fetch/README.md +2 -1
- package/node_modules/node-fetch/lib/index.es.js +1 -5
- package/node_modules/node-fetch/lib/index.js +1 -4
- package/node_modules/node-fetch/lib/index.mjs +1 -5
- package/node_modules/node-fetch/package.json +5 -5
- package/node_modules/tar/lib/pack.js +18 -6
- package/node_modules/tar/lib/parse.js +46 -3
- package/node_modules/tar/lib/replace.js +1 -1
- package/node_modules/tar/lib/update.js +1 -1
- package/node_modules/tar/package.json +5 -10
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [4.1.0] - 2023-12-13
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- definitions: appendPage optionnal parameter
|
|
15
|
+
- Build musl/musl-arm with node 20
|
|
16
|
+
- Support negative rotation in recipe page changes
|
|
17
|
+
- registerFont now returns recipe as stated in typescript definition
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- Add nodejs v21.0.0
|
|
22
|
+
|
|
23
|
+
## [4.0.0] - 2023-07-14
|
|
24
|
+
|
|
10
25
|
### Fixed
|
|
11
26
|
|
|
12
27
|
- Underline in text object
|
|
@@ -21,14 +36,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
21
36
|
- Electron v24.1, 24.2, 24.3, 24.4, 24.5, 24.6
|
|
22
37
|
- Add node 20.x
|
|
23
38
|
- Add electron v25.0, 25.1, 25.2, 25.3
|
|
39
|
+
- Option to add annotation replies to annotations
|
|
40
|
+
- Textboxes now show title and date as annotations in pdfs
|
|
24
41
|
|
|
25
42
|
### Removed
|
|
26
43
|
|
|
27
44
|
- Dependency to static-eval and static-module as they are not used directly
|
|
45
|
+
- Node versions: 11.x - 14.x
|
|
46
|
+
- Electron versions: 11.x - 14.2
|
|
28
47
|
|
|
29
48
|
### Changed
|
|
30
49
|
|
|
50
|
+
- Updated node-gyp version to 1.0.10
|
|
31
51
|
- Older node ubuntu 18.04 builds are now building on docker, as github actions removed 18.04
|
|
52
|
+
- CI linux builds use ubuntu 20.04 instead of 18.04 -> glibc Update, see readme for breaking changes in v4
|
|
32
53
|
|
|
33
54
|
## [3.8.0] - 2023-03-01
|
|
34
55
|
|
|
@@ -391,7 +412,9 @@ with the following changes.
|
|
|
391
412
|
|
|
392
413
|
- Initial release
|
|
393
414
|
|
|
394
|
-
[unreleased]: https://github.com/julianhille/MuhammaraJS/compare/
|
|
415
|
+
[unreleased]: https://github.com/julianhille/MuhammaraJS/compare/4.1.0...HEAD
|
|
416
|
+
[4.1.0]: https://github.com/julianhille/MuhammaraJS/compare/4.0.0...4.1.0
|
|
417
|
+
[4.0.0]: https://github.com/julianhille/MuhammaraJS/compare/3.8.0...4.0.0
|
|
395
418
|
[3.8.0]: https://github.com/julianhille/MuhammaraJS/compare/3.7.0...3.8.0
|
|
396
419
|
[3.7.0]: https://github.com/julianhille/MuhammaraJS/compare/3.6.0...3.7.0
|
|
397
420
|
[3.6.0]: https://github.com/julianhille/MuhammaraJS/compare/3.5.0...3.6.0
|
|
@@ -5,17 +5,16 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
function PDFRStreamForBuffer(buffer) {
|
|
8
|
-
this.
|
|
8
|
+
this.buffer = buffer;
|
|
9
9
|
this.rposition = 0;
|
|
10
|
-
this.fileSize = this.
|
|
10
|
+
this.fileSize = this.buffer.length;
|
|
11
11
|
this.mStartPosition = 0;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
PDFRStreamForBuffer.prototype.read = function (inAmount) {
|
|
15
15
|
var amountToRead = inAmount;
|
|
16
|
-
var arr =
|
|
17
|
-
this.rposition,
|
|
18
|
-
this.rposition + amountToRead
|
|
16
|
+
var arr = Array.from(
|
|
17
|
+
this.buffer.subarray(this.rposition, this.rposition + amountToRead)
|
|
19
18
|
);
|
|
20
19
|
this.rposition += amountToRead;
|
|
21
20
|
return arr;
|
package/lib/recipe/annotation.js
CHANGED
|
@@ -27,18 +27,22 @@ exports.comment = function comment(text = "", x, y, options = {}) {
|
|
|
27
27
|
* @name annot
|
|
28
28
|
* @function
|
|
29
29
|
* @memberof Recipe
|
|
30
|
-
* @todo support for rich
|
|
30
|
+
* @todo support for rich text RC
|
|
31
31
|
* @todo support for opacity CA
|
|
32
32
|
* @param {number} x - The coordinate x
|
|
33
33
|
* @param {number} y - The coordinate y
|
|
34
|
-
* @param {string} subtype - The markup annotation type 'Text'|'FreeText'|'Line'|'Square'|'Circle'|'Polygon'|'PolyLine'|'Highlight'|'Underline'|'Squiggly'|'StrikeOut'|'
|
|
34
|
+
* @param {string} subtype - The markup annotation type 'Text'|'Link'|'FreeText'|'Line'|'Square'|'Circle'|'Polygon'|'PolyLine'|'Highlight'|'Underline'|'Squiggly'|'StrikeOut'|'Caret'|'Stamp'|'Ink'|'Popup'|'FileAttachment'|'Sound'|'Movie'|'Screen'|'Widget'|'PrinterMark'|'TrapNet'|'Watermark'|'3D'|'Redact'|'Projection'|'RichMedia'
|
|
35
35
|
* @param {Object} [options] - The options
|
|
36
36
|
* @param {string} [options.title] - The title.
|
|
37
|
-
* @param {boolean} [options.open=false] - Open the annotation by default
|
|
37
|
+
* @param {boolean} [options.open=false] - Open the annotation. Annotation will be closed by default. Specific to text annotations; subtype='Text'
|
|
38
|
+
* @param {boolean} [options.richText] - Rich text
|
|
38
39
|
* @param {'invisible'|'hidden'|'print'|'nozoom'|'norotate'|'noview'|'readonly'|'locked'|'togglenoview'} [options.flag] - The flag property
|
|
39
|
-
* @param {'Comment'|'Key'|'Note'|'Help'|'NewParagraph'|'Paragraph'|'Insert'} [options.icon] - The icon of annotation.
|
|
40
|
+
* @param {'Comment'|'Key'|'Note'|'Help'|'NewParagraph'|'Paragraph'|'Insert'} [options.icon='Note'] - The icon of annotation. Specific to text annotations. Default value: 'Note'
|
|
40
41
|
* @param {number} [options.width] - Width
|
|
41
42
|
* @param {number} [options.height] - Height
|
|
43
|
+
* @param {string} [options.date] - Date of annotation
|
|
44
|
+
* @param {string} [options.subject] - The subject.
|
|
45
|
+
* @param {Array} [options.replies] - Array of annotation replies
|
|
42
46
|
*/
|
|
43
47
|
exports.annot = function annot(
|
|
44
48
|
x,
|
|
@@ -46,11 +50,12 @@ exports.annot = function annot(
|
|
|
46
50
|
subtype,
|
|
47
51
|
options = { text: "", width: 0, height: 0 }
|
|
48
52
|
) {
|
|
49
|
-
const { text, width, height } = options;
|
|
53
|
+
const { text, width, height, replies } = options;
|
|
50
54
|
this.annotationsToWrite.push({
|
|
51
55
|
subtype,
|
|
52
56
|
args: { text, x, y, width, height, options },
|
|
53
57
|
pageNumber: this.pageNumber,
|
|
58
|
+
replies,
|
|
54
59
|
});
|
|
55
60
|
return this;
|
|
56
61
|
};
|
|
@@ -59,8 +64,9 @@ exports.annot = function annot(
|
|
|
59
64
|
// Link, Popup, Movie, Widget, Screen, PrinterMark, TrapNet, Watermark, 3D
|
|
60
65
|
exports._attachNonMarkupAnnot = function _attachNonMarkupAnnot() {};
|
|
61
66
|
|
|
62
|
-
exports._annot = function _annot(subtype, args = {}, pageNumber) {
|
|
63
|
-
const { x, y, width, height,
|
|
67
|
+
exports._annot = function _annot(subtype, args = {}, pageNumber, ref) {
|
|
68
|
+
const { x, y, width, height, options, reply } = args;
|
|
69
|
+
let { text } = args;
|
|
64
70
|
this._startDictionary(pageNumber);
|
|
65
71
|
const { rotate } = this.metadata[pageNumber];
|
|
66
72
|
let { nx, ny } = this._calibrateCoordinateForAnnots(x, y, 0, 0, pageNumber);
|
|
@@ -92,7 +98,7 @@ exports._annot = function _annot(subtype, args = {}, pageNumber) {
|
|
|
92
98
|
{
|
|
93
99
|
title: "",
|
|
94
100
|
subject: "",
|
|
95
|
-
date:
|
|
101
|
+
date: "",
|
|
96
102
|
open: false,
|
|
97
103
|
flag: "", // 'readonly'
|
|
98
104
|
},
|
|
@@ -103,6 +109,15 @@ exports._annot = function _annot(subtype, args = {}, pageNumber) {
|
|
|
103
109
|
const ey = nHeight ? nHeight : 0;
|
|
104
110
|
const position = [nx, ny, nx + ex, ny + ey];
|
|
105
111
|
|
|
112
|
+
if (reply && ref) {
|
|
113
|
+
text = reply.text;
|
|
114
|
+
params.title = reply.title || params.title;
|
|
115
|
+
params.date = reply.date || params.date;
|
|
116
|
+
params.subject = reply.subject || params.subject;
|
|
117
|
+
params.richText = Boolean(reply.richText);
|
|
118
|
+
params.flag = reply.flag || params.flag;
|
|
119
|
+
}
|
|
120
|
+
|
|
106
121
|
this.dictionaryContext
|
|
107
122
|
.writeKey("Type")
|
|
108
123
|
.writeNameValue("Annot")
|
|
@@ -117,7 +132,9 @@ exports._annot = function _annot(subtype, args = {}, pageNumber) {
|
|
|
117
132
|
.writeKey("T")
|
|
118
133
|
.writeLiteralStringValue(params.title || "")
|
|
119
134
|
.writeKey("M")
|
|
120
|
-
.writeLiteralStringValue(
|
|
135
|
+
.writeLiteralStringValue(
|
|
136
|
+
this.writer.createPDFDate(new Date(params.date)).toString()
|
|
137
|
+
)
|
|
121
138
|
.writeKey("Open")
|
|
122
139
|
.writeBooleanValue(params.open)
|
|
123
140
|
.writeKey("F")
|
|
@@ -127,9 +144,9 @@ exports._annot = function _annot(subtype, args = {}, pageNumber) {
|
|
|
127
144
|
* Rich Text Strings
|
|
128
145
|
* 12.7.3.4
|
|
129
146
|
*/
|
|
130
|
-
if (text &&
|
|
147
|
+
if (text && params.richText) {
|
|
131
148
|
const richText =
|
|
132
|
-
text.substring(0, 5) !== "<?xml" ? contentToRC(text) :
|
|
149
|
+
text.substring(0, 5) !== "<?xml" ? contentToRC(text) : params.richText;
|
|
133
150
|
const richTextContent = richText;
|
|
134
151
|
this.dictionaryContext
|
|
135
152
|
.writeKey("RC")
|
|
@@ -141,6 +158,14 @@ exports._annot = function _annot(subtype, args = {}, pageNumber) {
|
|
|
141
158
|
.writeLiteralStringValue(textContent);
|
|
142
159
|
}
|
|
143
160
|
|
|
161
|
+
if (reply && ref) {
|
|
162
|
+
this.dictionaryContext
|
|
163
|
+
.writeKey("IRT")
|
|
164
|
+
.writeObjectReferenceValue(ref)
|
|
165
|
+
.writeKey("RT")
|
|
166
|
+
.writeNameValue("R");
|
|
167
|
+
}
|
|
168
|
+
|
|
144
169
|
let { border, color } = options;
|
|
145
170
|
|
|
146
171
|
if (this._getTextMarkupAnnotationSubtype(subtype)) {
|
|
@@ -212,12 +237,19 @@ exports._annot = function _annot(subtype, args = {}, pageNumber) {
|
|
|
212
237
|
if (params.icon) {
|
|
213
238
|
this.dictionaryContext.writeKey("Name").writeNameValue(params.icon);
|
|
214
239
|
}
|
|
215
|
-
this._endDictionary(pageNumber);
|
|
240
|
+
return this._endDictionary(pageNumber);
|
|
216
241
|
};
|
|
217
242
|
|
|
218
243
|
exports._writeAnnotations = function _writeAnnotations() {
|
|
219
244
|
this.annotationsToWrite.forEach((annot) => {
|
|
220
|
-
this._annot(annot.subtype, annot.args, annot.pageNumber);
|
|
245
|
+
const ref = this._annot(annot.subtype, annot.args, annot.pageNumber);
|
|
246
|
+
|
|
247
|
+
if (annot.replies) {
|
|
248
|
+
annot.replies.forEach((reply) => {
|
|
249
|
+
annot.args.reply = reply;
|
|
250
|
+
this._annot(annot.subtype, annot.args, annot.pageNumber, ref);
|
|
251
|
+
});
|
|
252
|
+
}
|
|
221
253
|
});
|
|
222
254
|
this.annotations.forEach((pageAnnots, index) => {
|
|
223
255
|
this._writeAnnotation(index);
|
|
@@ -276,6 +308,8 @@ exports._endDictionary = function _endDictionary(pageNumber) {
|
|
|
276
308
|
const pageIndex = pageNumber - 1;
|
|
277
309
|
this.annotations[pageIndex] = this.annotations[pageIndex] || [];
|
|
278
310
|
this.annotations[pageIndex].push(this.dictionaryObject);
|
|
311
|
+
|
|
312
|
+
return this.dictionaryObject;
|
|
279
313
|
};
|
|
280
314
|
|
|
281
315
|
exports._getTextMarkupAnnotationSubtype =
|
package/lib/recipe/font.js
CHANGED
package/lib/recipe/page.js
CHANGED
|
@@ -184,12 +184,15 @@ exports._resumePageRotation = function _resumePageRotation(
|
|
|
184
184
|
|
|
185
185
|
switch (rotate) {
|
|
186
186
|
case 90:
|
|
187
|
+
case -270:
|
|
187
188
|
context.cm(0, 1, -1, 0, height - startX, startY);
|
|
188
189
|
break;
|
|
189
190
|
case 180:
|
|
191
|
+
case -180:
|
|
190
192
|
context.cm(-1, 0, 0, -1, width, height);
|
|
191
193
|
break;
|
|
192
194
|
case 270:
|
|
195
|
+
case -90:
|
|
193
196
|
context.cm(0, -1, 1, 0, startX, width - startY);
|
|
194
197
|
break;
|
|
195
198
|
|
package/lib/recipe/text.js
CHANGED
|
@@ -238,6 +238,13 @@ exports._makeTextBox = function _makeTextBox(options) {
|
|
|
238
238
|
* @param {string|number[]} [options.textBox.style.fill] - Text Box border background color (HexColor, PercentColor or DecimalColor)
|
|
239
239
|
* @param {number} [options.textBox.style.opacity=1] - Text Box border background opacity
|
|
240
240
|
* @param {boolean|number|number[]} [options.textBox.style.borderRadius=0] - Border radius to apply to get rounded corners.
|
|
241
|
+
* @param {string} [options.title] - Title of annotation
|
|
242
|
+
* @param {boolean} [options.open=false] - Open the annotation. Annotation will be closed by default. Specific to text annotations; subtype='Text'
|
|
243
|
+
* @param {boolean} [options.richText] - Rich text in annotation
|
|
244
|
+
* @param {AnnotOptionsFlag} [options.flag] - The flag property of annotation
|
|
245
|
+
* @param {AnnotOptionsIcon} [options.icon='Note'] - The icon of annotation. Specific to text annotations. Default value: 'Note'
|
|
246
|
+
* @param {string} [options.date] - Date of text to show up on annotation
|
|
247
|
+
* @param {string} [options.subject] - Subject of annotation
|
|
241
248
|
* When true is given, the default radius size for all corners is 5. A four number array may be used to give specific sizees to each
|
|
242
249
|
* corner. The numbering starts from the top, left corner, and goes clockwise around the text box.
|
|
243
250
|
*/
|
|
@@ -562,13 +569,24 @@ exports.text = function text(text = "", x, y, options = {}) {
|
|
|
562
569
|
typeof targetAnnotations[key] != "object"
|
|
563
570
|
? {}
|
|
564
571
|
: targetAnnotations[key];
|
|
572
|
+
const { title, open, richText, flag, icon, date, subject } =
|
|
573
|
+
targetAnnotations;
|
|
565
574
|
Object.assign(markupOption, {
|
|
566
575
|
height: textHeight * 1.4,
|
|
567
576
|
width: currentLineWidth,
|
|
568
577
|
text: markupOption.text || "",
|
|
569
578
|
_textHeight: textHeight,
|
|
579
|
+
// add options to annotation
|
|
580
|
+
title: title || "",
|
|
581
|
+
open: Boolean(open),
|
|
582
|
+
richText: Boolean(richText),
|
|
583
|
+
flag: flag || "",
|
|
584
|
+
icon: icon || "",
|
|
585
|
+
date: date || "",
|
|
586
|
+
subject: subject || "",
|
|
570
587
|
});
|
|
571
588
|
const { ox, oy } = this._reverseCoordinate(x, y - textHeight * 0.2);
|
|
589
|
+
|
|
572
590
|
this.annot(ox, oy, subtype, markupOption);
|
|
573
591
|
}
|
|
574
592
|
}
|
package/muhammara.d.ts
CHANGED
|
@@ -820,6 +820,7 @@ declare module "muhammara" {
|
|
|
820
820
|
|
|
821
821
|
type AnnotSubtype =
|
|
822
822
|
| "Text"
|
|
823
|
+
| "Link"
|
|
823
824
|
| "FreeText"
|
|
824
825
|
| "Line"
|
|
825
826
|
| "Square"
|
|
@@ -830,11 +831,22 @@ declare module "muhammara" {
|
|
|
830
831
|
| "Underline"
|
|
831
832
|
| "Squiggly"
|
|
832
833
|
| "StrikeOut"
|
|
833
|
-
| "Stamp"
|
|
834
834
|
| "Caret"
|
|
835
|
+
| "Stamp"
|
|
835
836
|
| "Ink"
|
|
837
|
+
| "Popup"
|
|
836
838
|
| "FileAttachment"
|
|
837
|
-
| "Sound"
|
|
839
|
+
| "Sound"
|
|
840
|
+
| "Movie"
|
|
841
|
+
| "Screen"
|
|
842
|
+
| "Widget"
|
|
843
|
+
| "PrinterMark"
|
|
844
|
+
| "TrapNet"
|
|
845
|
+
| "Watermark"
|
|
846
|
+
| "3D"
|
|
847
|
+
| "Redact"
|
|
848
|
+
| "Projection"
|
|
849
|
+
| "RichMedia";
|
|
838
850
|
|
|
839
851
|
type AnnotOptionsFlag =
|
|
840
852
|
| "invisible"
|
|
@@ -845,7 +857,8 @@ declare module "muhammara" {
|
|
|
845
857
|
| "noview"
|
|
846
858
|
| "readonly"
|
|
847
859
|
| "locked"
|
|
848
|
-
| "togglenoview"
|
|
860
|
+
| "togglenoview"
|
|
861
|
+
| "lockedcontents";
|
|
849
862
|
|
|
850
863
|
type AnnotOptionsIcon =
|
|
851
864
|
| "Comment"
|
|
@@ -880,6 +893,19 @@ declare module "muhammara" {
|
|
|
880
893
|
icon?: AnnotOptionsIcon;
|
|
881
894
|
width?: number;
|
|
882
895
|
height?: number;
|
|
896
|
+
date?: string;
|
|
897
|
+
subject?: string;
|
|
898
|
+
replies?: Array<AnnotReply>;
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
interface AnnotReply {
|
|
902
|
+
subtype?: AnnotSubtype;
|
|
903
|
+
text: string;
|
|
904
|
+
title?: string;
|
|
905
|
+
richText?: boolean;
|
|
906
|
+
flag?: AnnotOptionsFlag;
|
|
907
|
+
date?: string;
|
|
908
|
+
subject?: string;
|
|
883
909
|
}
|
|
884
910
|
|
|
885
911
|
interface EncryptOptions {
|
|
@@ -954,6 +980,13 @@ declare module "muhammara" {
|
|
|
954
980
|
opacity?: number;
|
|
955
981
|
};
|
|
956
982
|
textBox?: TextBox;
|
|
983
|
+
title?: string;
|
|
984
|
+
open?: boolean;
|
|
985
|
+
richText?: boolean;
|
|
986
|
+
flag?: AnnotOptionsFlag;
|
|
987
|
+
icon?: AnnotOptionsIcon;
|
|
988
|
+
date?: string;
|
|
989
|
+
subject?: string;
|
|
957
990
|
}
|
|
958
991
|
|
|
959
992
|
interface LineToOptions {
|
|
@@ -1007,9 +1040,17 @@ declare module "muhammara" {
|
|
|
1007
1040
|
}
|
|
1008
1041
|
|
|
1009
1042
|
export class Recipe {
|
|
1010
|
-
constructor(
|
|
1011
|
-
|
|
1012
|
-
|
|
1043
|
+
constructor(
|
|
1044
|
+
src: string,
|
|
1045
|
+
output?: string | null,
|
|
1046
|
+
options?: Recipe.RecipeOptions
|
|
1047
|
+
);
|
|
1048
|
+
|
|
1049
|
+
constructor(
|
|
1050
|
+
buffer: Buffer,
|
|
1051
|
+
output?: string | null,
|
|
1052
|
+
options?: Recipe.RecipeOptions
|
|
1053
|
+
);
|
|
1013
1054
|
|
|
1014
1055
|
comment(
|
|
1015
1056
|
text: string,
|
|
@@ -1025,7 +1066,7 @@ declare module "muhammara" {
|
|
|
1025
1066
|
options?: Recipe.AnnotOptions
|
|
1026
1067
|
): Recipe;
|
|
1027
1068
|
|
|
1028
|
-
appendPage(pdfSrc: string, pages
|
|
1069
|
+
appendPage(pdfSrc: string, pages?: number | number[]): Recipe;
|
|
1029
1070
|
|
|
1030
1071
|
encrypt(options: Recipe.EncryptOptions): Recipe;
|
|
1031
1072
|
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# For most projects, this workflow file will not need changing; you simply need
|
|
2
|
+
# to commit it to your repository.
|
|
3
|
+
#
|
|
4
|
+
# You may wish to alter this file to override the set of languages analyzed,
|
|
5
|
+
# or to provide custom queries or build logic.
|
|
6
|
+
#
|
|
7
|
+
# ******** NOTE ********
|
|
8
|
+
# We have attempted to detect the languages in your repository. Please check
|
|
9
|
+
# the `language` matrix defined below to confirm you have the correct set of
|
|
10
|
+
# supported CodeQL languages.
|
|
11
|
+
#
|
|
12
|
+
name: "CodeQL"
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
push:
|
|
16
|
+
branches: [ "master" ]
|
|
17
|
+
pull_request:
|
|
18
|
+
# The branches below must be a subset of the branches above
|
|
19
|
+
branches: [ "master" ]
|
|
20
|
+
schedule:
|
|
21
|
+
- cron: '24 5 * * 4'
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
analyze:
|
|
25
|
+
name: Analyze
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
permissions:
|
|
28
|
+
actions: read
|
|
29
|
+
contents: read
|
|
30
|
+
security-events: write
|
|
31
|
+
|
|
32
|
+
strategy:
|
|
33
|
+
fail-fast: false
|
|
34
|
+
matrix:
|
|
35
|
+
language: [ 'javascript' ]
|
|
36
|
+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
|
37
|
+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
|
38
|
+
|
|
39
|
+
steps:
|
|
40
|
+
- name: Checkout repository
|
|
41
|
+
uses: actions/checkout@v3
|
|
42
|
+
|
|
43
|
+
# Initializes the CodeQL tools for scanning.
|
|
44
|
+
- name: Initialize CodeQL
|
|
45
|
+
uses: github/codeql-action/init@v2
|
|
46
|
+
with:
|
|
47
|
+
languages: ${{ matrix.language }}
|
|
48
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
49
|
+
# By default, queries listed here will override any specified in a config file.
|
|
50
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
51
|
+
|
|
52
|
+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
|
53
|
+
# queries: security-extended,security-and-quality
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
|
|
57
|
+
# If this step fails, then you should remove it and run the build manually (see below)
|
|
58
|
+
- name: Autobuild
|
|
59
|
+
uses: github/codeql-action/autobuild@v2
|
|
60
|
+
|
|
61
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
|
62
|
+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
|
63
|
+
|
|
64
|
+
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
|
65
|
+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
|
66
|
+
|
|
67
|
+
# - run: |
|
|
68
|
+
# echo "Run, Build Application using script"
|
|
69
|
+
# ./location_of_script_within_repo/buildscript.sh
|
|
70
|
+
|
|
71
|
+
- name: Perform CodeQL Analysis
|
|
72
|
+
uses: github/codeql-action/analyze@v2
|
|
73
|
+
with:
|
|
74
|
+
category: "/language:${{matrix.language}}"
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# node-pre-gyp changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.11
|
|
4
|
+
- Fixes dependabot alert [CVE-2021-44906](https://nvd.nist.gov/vuln/detail/CVE-2021-44906)
|
|
5
|
+
|
|
3
6
|
## 1.0.10
|
|
4
7
|
- Upgraded minimist to 1.2.6 to address dependabot alert [CVE-2021-44906](https://nvd.nist.gov/vuln/detail/CVE-2021-44906)
|
|
5
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_from": "@mapbox/node-pre-gyp@^1.0.10",
|
|
3
|
-
"_id": "@mapbox/node-pre-gyp@1.0.
|
|
3
|
+
"_id": "@mapbox/node-pre-gyp@1.0.11",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==",
|
|
6
6
|
"_location": "/@mapbox/node-pre-gyp",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"_requiredBy": [
|
|
20
20
|
"/"
|
|
21
21
|
],
|
|
22
|
-
"_resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.
|
|
23
|
-
"_shasum": "
|
|
22
|
+
"_resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz",
|
|
23
|
+
"_shasum": "417db42b7f5323d79e93b34a6d7a2a12c0df43fa",
|
|
24
24
|
"_spec": "@mapbox/node-pre-gyp@^1.0.10",
|
|
25
25
|
"_where": "/home/runner/work/MuhammaraJS/MuhammaraJS",
|
|
26
26
|
"author": {
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"update-crosswalk": "node scripts/abi_crosswalk.js",
|
|
94
94
|
"upload-coverage": "nyc report --reporter json && codecov --clear --flags=unit --file=./coverage/coverage-final.json"
|
|
95
95
|
},
|
|
96
|
-
"version": "1.0.
|
|
96
|
+
"version": "1.0.11"
|
|
97
97
|
}
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"fetchSpec": "^1.0.0"
|
|
17
17
|
},
|
|
18
18
|
"_requiredBy": [
|
|
19
|
-
"/brace-expansion"
|
|
19
|
+
"/brace-expansion",
|
|
20
|
+
"/mocha/minimatch/brace-expansion"
|
|
20
21
|
],
|
|
21
22
|
"_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
|
22
23
|
"_shasum": "e83e3a7e3f300b34cb9d87f615fa0cbf357690ee",
|
|
@@ -8,6 +8,9 @@ Currently supports detection of GNU glibc and MUSL libc.
|
|
|
8
8
|
Provides asychronous and synchronous functions for the
|
|
9
9
|
family (e.g. `glibc`, `musl`) and version (e.g. `1.23`, `1.2.3`).
|
|
10
10
|
|
|
11
|
+
The version numbers of libc implementations
|
|
12
|
+
are not guaranteed to be semver-compliant.
|
|
13
|
+
|
|
11
14
|
For previous v1.x releases, please see the
|
|
12
15
|
[v1](https://github.com/lovell/detect-libc/tree/v1) branch.
|
|
13
16
|
|
|
@@ -147,7 +150,7 @@ if (isNonGlibcLinuxSync()) { ... }
|
|
|
147
150
|
|
|
148
151
|
## Licensing
|
|
149
152
|
|
|
150
|
-
Copyright 2017
|
|
153
|
+
Copyright 2017 Lovell Fuller and others.
|
|
151
154
|
|
|
152
155
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
153
156
|
you may not use this file except in compliance with the License.
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
// Copyright 2017 Lovell Fuller and others.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
1
4
|
'use strict';
|
|
2
5
|
|
|
3
6
|
const childProcess = require('child_process');
|
|
4
7
|
const { isLinux, getReport } = require('./process');
|
|
8
|
+
const { LDD_PATH, readFile, readFileSync } = require('./filesystem');
|
|
9
|
+
|
|
10
|
+
let cachedFamilyFilesystem;
|
|
11
|
+
let cachedVersionFilesystem;
|
|
5
12
|
|
|
6
13
|
const command = 'getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true';
|
|
7
14
|
let commandOut = '';
|
|
@@ -36,6 +43,12 @@ const safeCommandSync = () => {
|
|
|
36
43
|
*/
|
|
37
44
|
const GLIBC = 'glibc';
|
|
38
45
|
|
|
46
|
+
/**
|
|
47
|
+
* A Regexp constant to get the GLIBC Version.
|
|
48
|
+
* @type {string}
|
|
49
|
+
*/
|
|
50
|
+
const RE_GLIBC_VERSION = /GLIBC\s(\d+\.\d+)/;
|
|
51
|
+
|
|
39
52
|
/**
|
|
40
53
|
* A String constant containing the value `musl`.
|
|
41
54
|
* @type {string}
|
|
@@ -43,6 +56,18 @@ const GLIBC = 'glibc';
|
|
|
43
56
|
*/
|
|
44
57
|
const MUSL = 'musl';
|
|
45
58
|
|
|
59
|
+
/**
|
|
60
|
+
* This string is used to find if the {@link LDD_PATH} is GLIBC
|
|
61
|
+
* @type {string}
|
|
62
|
+
*/
|
|
63
|
+
const GLIBC_ON_LDD = GLIBC.toUpperCase();
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* This string is used to find if the {@link LDD_PATH} is musl
|
|
67
|
+
* @type {string}
|
|
68
|
+
*/
|
|
69
|
+
const MUSL_ON_LDD = MUSL.toLowerCase();
|
|
70
|
+
|
|
46
71
|
const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-');
|
|
47
72
|
|
|
48
73
|
const familyFromReport = () => {
|
|
@@ -69,6 +94,40 @@ const familyFromCommand = (out) => {
|
|
|
69
94
|
return null;
|
|
70
95
|
};
|
|
71
96
|
|
|
97
|
+
const getFamilyFromLddContent = (content) => {
|
|
98
|
+
if (content.includes(MUSL_ON_LDD)) {
|
|
99
|
+
return MUSL;
|
|
100
|
+
}
|
|
101
|
+
if (content.includes(GLIBC_ON_LDD)) {
|
|
102
|
+
return GLIBC;
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const familyFromFilesystem = async () => {
|
|
108
|
+
if (cachedFamilyFilesystem !== undefined) {
|
|
109
|
+
return cachedFamilyFilesystem;
|
|
110
|
+
}
|
|
111
|
+
cachedFamilyFilesystem = null;
|
|
112
|
+
try {
|
|
113
|
+
const lddContent = await readFile(LDD_PATH);
|
|
114
|
+
cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
|
|
115
|
+
} catch (e) {}
|
|
116
|
+
return cachedFamilyFilesystem;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const familyFromFilesystemSync = () => {
|
|
120
|
+
if (cachedFamilyFilesystem !== undefined) {
|
|
121
|
+
return cachedFamilyFilesystem;
|
|
122
|
+
}
|
|
123
|
+
cachedFamilyFilesystem = null;
|
|
124
|
+
try {
|
|
125
|
+
const lddContent = readFileSync(LDD_PATH);
|
|
126
|
+
cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
|
|
127
|
+
} catch (e) {}
|
|
128
|
+
return cachedFamilyFilesystem;
|
|
129
|
+
};
|
|
130
|
+
|
|
72
131
|
/**
|
|
73
132
|
* Resolves with the libc family when it can be determined, `null` otherwise.
|
|
74
133
|
* @returns {Promise<?string>}
|
|
@@ -76,7 +135,10 @@ const familyFromCommand = (out) => {
|
|
|
76
135
|
const family = async () => {
|
|
77
136
|
let family = null;
|
|
78
137
|
if (isLinux()) {
|
|
79
|
-
family =
|
|
138
|
+
family = await familyFromFilesystem();
|
|
139
|
+
if (!family) {
|
|
140
|
+
family = familyFromReport();
|
|
141
|
+
}
|
|
80
142
|
if (!family) {
|
|
81
143
|
const out = await safeCommand();
|
|
82
144
|
family = familyFromCommand(out);
|
|
@@ -92,7 +154,10 @@ const family = async () => {
|
|
|
92
154
|
const familySync = () => {
|
|
93
155
|
let family = null;
|
|
94
156
|
if (isLinux()) {
|
|
95
|
-
family =
|
|
157
|
+
family = familyFromFilesystemSync();
|
|
158
|
+
if (!family) {
|
|
159
|
+
family = familyFromReport();
|
|
160
|
+
}
|
|
96
161
|
if (!family) {
|
|
97
162
|
const out = safeCommandSync();
|
|
98
163
|
family = familyFromCommand(out);
|
|
@@ -113,6 +178,36 @@ const isNonGlibcLinux = async () => isLinux() && await family() !== GLIBC;
|
|
|
113
178
|
*/
|
|
114
179
|
const isNonGlibcLinuxSync = () => isLinux() && familySync() !== GLIBC;
|
|
115
180
|
|
|
181
|
+
const versionFromFilesystem = async () => {
|
|
182
|
+
if (cachedVersionFilesystem !== undefined) {
|
|
183
|
+
return cachedVersionFilesystem;
|
|
184
|
+
}
|
|
185
|
+
cachedVersionFilesystem = null;
|
|
186
|
+
try {
|
|
187
|
+
const lddContent = await readFile(LDD_PATH);
|
|
188
|
+
const versionMatch = lddContent.match(RE_GLIBC_VERSION);
|
|
189
|
+
if (versionMatch) {
|
|
190
|
+
cachedVersionFilesystem = versionMatch[1];
|
|
191
|
+
}
|
|
192
|
+
} catch (e) {}
|
|
193
|
+
return cachedVersionFilesystem;
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
const versionFromFilesystemSync = () => {
|
|
197
|
+
if (cachedVersionFilesystem !== undefined) {
|
|
198
|
+
return cachedVersionFilesystem;
|
|
199
|
+
}
|
|
200
|
+
cachedVersionFilesystem = null;
|
|
201
|
+
try {
|
|
202
|
+
const lddContent = readFileSync(LDD_PATH);
|
|
203
|
+
const versionMatch = lddContent.match(RE_GLIBC_VERSION);
|
|
204
|
+
if (versionMatch) {
|
|
205
|
+
cachedVersionFilesystem = versionMatch[1];
|
|
206
|
+
}
|
|
207
|
+
} catch (e) {}
|
|
208
|
+
return cachedVersionFilesystem;
|
|
209
|
+
};
|
|
210
|
+
|
|
116
211
|
const versionFromReport = () => {
|
|
117
212
|
const report = getReport();
|
|
118
213
|
if (report.header && report.header.glibcVersionRuntime) {
|
|
@@ -141,7 +236,10 @@ const versionFromCommand = (out) => {
|
|
|
141
236
|
const version = async () => {
|
|
142
237
|
let version = null;
|
|
143
238
|
if (isLinux()) {
|
|
144
|
-
version =
|
|
239
|
+
version = await versionFromFilesystem();
|
|
240
|
+
if (!version) {
|
|
241
|
+
version = versionFromReport();
|
|
242
|
+
}
|
|
145
243
|
if (!version) {
|
|
146
244
|
const out = await safeCommand();
|
|
147
245
|
version = versionFromCommand(out);
|
|
@@ -157,7 +255,10 @@ const version = async () => {
|
|
|
157
255
|
const versionSync = () => {
|
|
158
256
|
let version = null;
|
|
159
257
|
if (isLinux()) {
|
|
160
|
-
version =
|
|
258
|
+
version = versionFromFilesystemSync();
|
|
259
|
+
if (!version) {
|
|
260
|
+
version = versionFromReport();
|
|
261
|
+
}
|
|
161
262
|
if (!version) {
|
|
162
263
|
const out = safeCommandSync();
|
|
163
264
|
version = versionFromCommand(out);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Copyright 2017 Lovell Fuller and others.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
'use strict';
|
|
5
|
+
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The path where we can find the ldd
|
|
10
|
+
*/
|
|
11
|
+
const LDD_PATH = '/usr/bin/ldd';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Read the content of a file synchronous
|
|
15
|
+
*
|
|
16
|
+
* @param {string} path
|
|
17
|
+
* @returns {string}
|
|
18
|
+
*/
|
|
19
|
+
const readFileSync = (path) => fs.readFileSync(path, 'utf-8');
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Read the content of a file
|
|
23
|
+
*
|
|
24
|
+
* @param {string} path
|
|
25
|
+
* @returns {Promise<string>}
|
|
26
|
+
*/
|
|
27
|
+
const readFile = (path) => new Promise((resolve, reject) => {
|
|
28
|
+
fs.readFile(path, 'utf-8', (err, data) => {
|
|
29
|
+
if (err) {
|
|
30
|
+
reject(err);
|
|
31
|
+
} else {
|
|
32
|
+
resolve(data);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
module.exports = {
|
|
38
|
+
LDD_PATH,
|
|
39
|
+
readFileSync,
|
|
40
|
+
readFile
|
|
41
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_from": "detect-libc@^2.0.0",
|
|
3
|
-
"_id": "detect-libc@2.0.
|
|
3
|
+
"_id": "detect-libc@2.0.2",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==",
|
|
6
6
|
"_location": "/detect-libc",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"_requiredBy": [
|
|
19
19
|
"/@mapbox/node-pre-gyp"
|
|
20
20
|
],
|
|
21
|
-
"_resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.
|
|
22
|
-
"_shasum": "
|
|
21
|
+
"_resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz",
|
|
22
|
+
"_shasum": "8ccf2ba9315350e1241b88d0ac3b0e1fbd99605d",
|
|
23
23
|
"_spec": "detect-libc@^2.0.0",
|
|
24
24
|
"_where": "/home/runner/work/MuhammaraJS/MuhammaraJS/node_modules/@mapbox/node-pre-gyp",
|
|
25
25
|
"author": {
|
|
@@ -34,12 +34,17 @@
|
|
|
34
34
|
{
|
|
35
35
|
"name": "Niklas Salmoukas",
|
|
36
36
|
"email": "niklas@salmoukas.com"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "Vinícius Lourenço",
|
|
40
|
+
"email": "vinyygamerlol@gmail.com"
|
|
37
41
|
}
|
|
38
42
|
],
|
|
39
43
|
"deprecated": false,
|
|
40
44
|
"description": "Node.js module to detect the C standard library (libc) implementation family and version",
|
|
41
45
|
"devDependencies": {
|
|
42
46
|
"ava": "^2.4.0",
|
|
47
|
+
"benchmark": "^2.1.4",
|
|
43
48
|
"nyc": "^15.1.0",
|
|
44
49
|
"proxyquire": "^2.1.3",
|
|
45
50
|
"semistandard": "^14.2.3"
|
|
@@ -65,7 +70,9 @@
|
|
|
65
70
|
"url": "git://github.com/lovell/detect-libc.git"
|
|
66
71
|
},
|
|
67
72
|
"scripts": {
|
|
73
|
+
"bench": "node benchmark/detect-libc",
|
|
74
|
+
"bench:calls": "node benchmark/call-familySync.js && sleep 1 && node benchmark/call-isNonGlibcLinuxSync.js && sleep 1 && node benchmark/call-versionSync.js",
|
|
68
75
|
"test": "semistandard && nyc --reporter=lcov --check-coverage --branches=100 ava test/unit.js"
|
|
69
76
|
},
|
|
70
|
-
"version": "2.0.
|
|
77
|
+
"version": "2.0.2"
|
|
71
78
|
}
|
|
@@ -387,7 +387,6 @@ Header | Value
|
|
|
387
387
|
------------------- | --------------------------------------------------------
|
|
388
388
|
`Accept-Encoding` | `gzip,deflate` _(when `options.compress === true`)_
|
|
389
389
|
`Accept` | `*/*`
|
|
390
|
-
`Connection` | `close` _(when no `options.agent` is present)_
|
|
391
390
|
`Content-Length` | _(automatically calculated, if possible)_
|
|
392
391
|
`Transfer-Encoding` | `chunked` _(when `req.body` is a stream)_
|
|
393
392
|
`User-Agent` | `node-fetch/1.0 (+https://github.com/bitinn/node-fetch)`
|
|
@@ -404,6 +403,8 @@ The `agent` option allows you to specify networking related options which are ou
|
|
|
404
403
|
|
|
405
404
|
See [`http.Agent`](https://nodejs.org/api/http.html#http_new_agent_options) for more information.
|
|
406
405
|
|
|
406
|
+
If no agent is specified, the default agent provided by Node.js is used. Note that [this changed in Node.js 19](https://github.com/nodejs/node/blob/4267b92604ad78584244488e7f7508a690cb80d0/lib/_http_agent.js#L564) to have `keepalive` true by default. If you wish to enable `keepalive` in an earlier version of Node.js, you can override the agent as per the following code sample.
|
|
407
|
+
|
|
407
408
|
In addition, the `agent` option accepts a function that returns `http`(s)`.Agent` instance given current [URL](https://nodejs.org/api/url.html), this is useful during a redirection chain across HTTP and HTTPS protocol.
|
|
408
409
|
|
|
409
410
|
```js
|
|
@@ -1361,10 +1361,6 @@ function getNodeRequestOptions(request) {
|
|
|
1361
1361
|
agent = agent(parsedURL);
|
|
1362
1362
|
}
|
|
1363
1363
|
|
|
1364
|
-
if (!headers.has('Connection') && !agent) {
|
|
1365
|
-
headers.set('Connection', 'close');
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
1364
|
// HTTP-network fetch step 4.2
|
|
1369
1365
|
// chunked encoding is handled by Node.js
|
|
1370
1366
|
|
|
@@ -1778,4 +1774,4 @@ fetch.isRedirect = function (code) {
|
|
|
1778
1774
|
fetch.Promise = global.Promise;
|
|
1779
1775
|
|
|
1780
1776
|
export default fetch;
|
|
1781
|
-
export { Headers, Request, Response, FetchError };
|
|
1777
|
+
export { Headers, Request, Response, FetchError, AbortError };
|
|
@@ -1365,10 +1365,6 @@ function getNodeRequestOptions(request) {
|
|
|
1365
1365
|
agent = agent(parsedURL);
|
|
1366
1366
|
}
|
|
1367
1367
|
|
|
1368
|
-
if (!headers.has('Connection') && !agent) {
|
|
1369
|
-
headers.set('Connection', 'close');
|
|
1370
|
-
}
|
|
1371
|
-
|
|
1372
1368
|
// HTTP-network fetch step 4.2
|
|
1373
1369
|
// chunked encoding is handled by Node.js
|
|
1374
1370
|
|
|
@@ -1788,3 +1784,4 @@ exports.Headers = Headers;
|
|
|
1788
1784
|
exports.Request = Request;
|
|
1789
1785
|
exports.Response = Response;
|
|
1790
1786
|
exports.FetchError = FetchError;
|
|
1787
|
+
exports.AbortError = AbortError;
|
|
@@ -1359,10 +1359,6 @@ function getNodeRequestOptions(request) {
|
|
|
1359
1359
|
agent = agent(parsedURL);
|
|
1360
1360
|
}
|
|
1361
1361
|
|
|
1362
|
-
if (!headers.has('Connection') && !agent) {
|
|
1363
|
-
headers.set('Connection', 'close');
|
|
1364
|
-
}
|
|
1365
|
-
|
|
1366
1362
|
// HTTP-network fetch step 4.2
|
|
1367
1363
|
// chunked encoding is handled by Node.js
|
|
1368
1364
|
|
|
@@ -1776,4 +1772,4 @@ fetch.isRedirect = function (code) {
|
|
|
1776
1772
|
fetch.Promise = global.Promise;
|
|
1777
1773
|
|
|
1778
1774
|
export default fetch;
|
|
1779
|
-
export { Headers, Request, Response, FetchError };
|
|
1775
|
+
export { Headers, Request, Response, FetchError, AbortError };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_from": "node-fetch@^2.6.7",
|
|
3
|
-
"_id": "node-fetch@2.
|
|
3
|
+
"_id": "node-fetch@2.7.0",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
|
|
6
6
|
"_location": "/node-fetch",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"_requiredBy": [
|
|
19
19
|
"/@mapbox/node-pre-gyp"
|
|
20
20
|
],
|
|
21
|
-
"_resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.
|
|
22
|
-
"_shasum": "
|
|
21
|
+
"_resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
|
|
22
|
+
"_shasum": "d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d",
|
|
23
23
|
"_spec": "node-fetch@^2.6.7",
|
|
24
24
|
"_where": "/home/runner/work/MuhammaraJS/MuhammaraJS/node_modules/@mapbox/node-pre-gyp",
|
|
25
25
|
"author": {
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"report": "cross-env BABEL_ENV=coverage nyc --reporter lcov --reporter text mocha -R spec test/test.js",
|
|
113
113
|
"test": "cross-env BABEL_ENV=test mocha --require babel-register --throw-deprecation test/test.js"
|
|
114
114
|
},
|
|
115
|
-
"version": "2.
|
|
115
|
+
"version": "2.7.0"
|
|
116
116
|
}
|
|
@@ -79,14 +79,26 @@ const Pack = warner(class Pack extends Minipass {
|
|
|
79
79
|
|
|
80
80
|
this.portable = !!opt.portable
|
|
81
81
|
this.zip = null
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
|
|
83
|
+
if (opt.gzip || opt.brotli) {
|
|
84
|
+
if (opt.gzip && opt.brotli) {
|
|
85
|
+
throw new TypeError('gzip and brotli are mutually exclusive')
|
|
85
86
|
}
|
|
86
|
-
if (
|
|
87
|
-
opt.gzip
|
|
87
|
+
if (opt.gzip) {
|
|
88
|
+
if (typeof opt.gzip !== 'object') {
|
|
89
|
+
opt.gzip = {}
|
|
90
|
+
}
|
|
91
|
+
if (this.portable) {
|
|
92
|
+
opt.gzip.portable = true
|
|
93
|
+
}
|
|
94
|
+
this.zip = new zlib.Gzip(opt.gzip)
|
|
95
|
+
}
|
|
96
|
+
if (opt.brotli) {
|
|
97
|
+
if (typeof opt.brotli !== 'object') {
|
|
98
|
+
opt.brotli = {}
|
|
99
|
+
}
|
|
100
|
+
this.zip = new zlib.BrotliCompress(opt.brotli)
|
|
88
101
|
}
|
|
89
|
-
this.zip = new zlib.Gzip(opt.gzip)
|
|
90
102
|
this.zip.on('data', chunk => super.write(chunk))
|
|
91
103
|
this.zip.on('end', _ => super.end())
|
|
92
104
|
this.zip.on('drain', _ => this[ONDRAIN]())
|
|
@@ -97,6 +97,16 @@ module.exports = warner(class Parser extends EE {
|
|
|
97
97
|
this.strict = !!opt.strict
|
|
98
98
|
this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize
|
|
99
99
|
this.filter = typeof opt.filter === 'function' ? opt.filter : noop
|
|
100
|
+
// Unlike gzip, brotli doesn't have any magic bytes to identify it
|
|
101
|
+
// Users need to explicitly tell us they're extracting a brotli file
|
|
102
|
+
// Or we infer from the file extension
|
|
103
|
+
const isTBR = (opt.file && (
|
|
104
|
+
opt.file.endsWith('.tar.br') || opt.file.endsWith('.tbr')))
|
|
105
|
+
// if it's a tbr file it MIGHT be brotli, but we don't know until
|
|
106
|
+
// we look at it and verify it's not a valid tar file.
|
|
107
|
+
this.brotli = !opt.gzip && opt.brotli !== undefined ? opt.brotli
|
|
108
|
+
: isTBR ? undefined
|
|
109
|
+
: false
|
|
100
110
|
|
|
101
111
|
// have to set this so that streams are ok piping into it
|
|
102
112
|
this.writable = true
|
|
@@ -347,7 +357,9 @@ module.exports = warner(class Parser extends EE {
|
|
|
347
357
|
}
|
|
348
358
|
|
|
349
359
|
// first write, might be gzipped
|
|
350
|
-
|
|
360
|
+
const needSniff = this[UNZIP] === null ||
|
|
361
|
+
this.brotli === undefined && this[UNZIP] === false
|
|
362
|
+
if (needSniff && chunk) {
|
|
351
363
|
if (this[BUFFER]) {
|
|
352
364
|
chunk = Buffer.concat([this[BUFFER], chunk])
|
|
353
365
|
this[BUFFER] = null
|
|
@@ -356,15 +368,45 @@ module.exports = warner(class Parser extends EE {
|
|
|
356
368
|
this[BUFFER] = chunk
|
|
357
369
|
return true
|
|
358
370
|
}
|
|
371
|
+
|
|
372
|
+
// look for gzip header
|
|
359
373
|
for (let i = 0; this[UNZIP] === null && i < gzipHeader.length; i++) {
|
|
360
374
|
if (chunk[i] !== gzipHeader[i]) {
|
|
361
375
|
this[UNZIP] = false
|
|
362
376
|
}
|
|
363
377
|
}
|
|
364
|
-
|
|
378
|
+
|
|
379
|
+
const maybeBrotli = this.brotli === undefined
|
|
380
|
+
if (this[UNZIP] === false && maybeBrotli) {
|
|
381
|
+
// read the first header to see if it's a valid tar file. If so,
|
|
382
|
+
// we can safely assume that it's not actually brotli, despite the
|
|
383
|
+
// .tbr or .tar.br file extension.
|
|
384
|
+
// if we ended before getting a full chunk, yes, def brotli
|
|
385
|
+
if (chunk.length < 512) {
|
|
386
|
+
if (this[ENDED]) {
|
|
387
|
+
this.brotli = true
|
|
388
|
+
} else {
|
|
389
|
+
this[BUFFER] = chunk
|
|
390
|
+
return true
|
|
391
|
+
}
|
|
392
|
+
} else {
|
|
393
|
+
// if it's tar, it's pretty reliably not brotli, chances of
|
|
394
|
+
// that happening are astronomical.
|
|
395
|
+
try {
|
|
396
|
+
new Header(chunk.slice(0, 512))
|
|
397
|
+
this.brotli = false
|
|
398
|
+
} catch (_) {
|
|
399
|
+
this.brotli = true
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
if (this[UNZIP] === null || (this[UNZIP] === false && this.brotli)) {
|
|
365
405
|
const ended = this[ENDED]
|
|
366
406
|
this[ENDED] = false
|
|
367
|
-
this[UNZIP] =
|
|
407
|
+
this[UNZIP] = this[UNZIP] === null
|
|
408
|
+
? new zlib.Unzip()
|
|
409
|
+
: new zlib.BrotliDecompress()
|
|
368
410
|
this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk))
|
|
369
411
|
this[UNZIP].on('error', er => this.abort(er))
|
|
370
412
|
this[UNZIP].on('end', _ => {
|
|
@@ -502,6 +544,7 @@ module.exports = warner(class Parser extends EE {
|
|
|
502
544
|
this[UNZIP].end(chunk)
|
|
503
545
|
} else {
|
|
504
546
|
this[ENDED] = true
|
|
547
|
+
if (this.brotli === undefined) chunk = chunk || Buffer.alloc(0)
|
|
505
548
|
this.write(chunk)
|
|
506
549
|
}
|
|
507
550
|
}
|
|
@@ -23,7 +23,7 @@ module.exports = (opt_, files, cb) => {
|
|
|
23
23
|
throw new TypeError('file is required')
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
if (opt.gzip) {
|
|
26
|
+
if (opt.gzip || opt.brotli || opt.file.endsWith('.br') || opt.file.endsWith('.tbr')) {
|
|
27
27
|
throw new TypeError('cannot append to compressed archives')
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -13,7 +13,7 @@ module.exports = (opt_, files, cb) => {
|
|
|
13
13
|
throw new TypeError('file is required')
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
if (opt.gzip) {
|
|
16
|
+
if (opt.gzip || opt.brotli || opt.file.endsWith('.br') || opt.file.endsWith('.tbr')) {
|
|
17
17
|
throw new TypeError('cannot append to compressed archives')
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_from": "tar@^6.1.11",
|
|
3
|
-
"_id": "tar@6.
|
|
3
|
+
"_id": "tar@6.2.0",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-/
|
|
5
|
+
"_integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==",
|
|
6
6
|
"_location": "/tar",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"_requiredBy": [
|
|
19
19
|
"/@mapbox/node-pre-gyp"
|
|
20
20
|
],
|
|
21
|
-
"_resolved": "https://registry.npmjs.org/tar/-/tar-6.
|
|
22
|
-
"_shasum": "
|
|
21
|
+
"_resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz",
|
|
22
|
+
"_shasum": "b14ce49a79cb1cd23bc9b016302dea5474493f73",
|
|
23
23
|
"_spec": "tar@^6.1.11",
|
|
24
24
|
"_where": "/home/runner/work/MuhammaraJS/MuhammaraJS/node_modules/@mapbox/node-pre-gyp",
|
|
25
25
|
"author": {
|
|
@@ -67,12 +67,7 @@
|
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
69
|
"genparse": "node scripts/generate-parse-fixtures.js",
|
|
70
|
-
"lint": "eslint \"**/*.js\"",
|
|
71
|
-
"lintfix": "npm run lint -- --fix",
|
|
72
|
-
"postlint": "template-oss-check",
|
|
73
|
-
"posttest": "npm run lint",
|
|
74
70
|
"snap": "tap",
|
|
75
|
-
"template-oss-apply": "template-oss-apply --force",
|
|
76
71
|
"test": "tap"
|
|
77
72
|
},
|
|
78
73
|
"tap": {
|
|
@@ -102,5 +97,5 @@
|
|
|
102
97
|
"18.x"
|
|
103
98
|
]
|
|
104
99
|
},
|
|
105
|
-
"version": "6.
|
|
100
|
+
"version": "6.2.0"
|
|
106
101
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "muhammara",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Create, read and modify PDF files and streams. A drop in replacement for hummusjs PDF library",
|
|
5
5
|
"homepage": "https://github.com/julianhille/Muhammarajs",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "^18.0.0",
|
|
47
47
|
"chai": "^4.3.6",
|
|
48
|
-
"mocha": "^
|
|
48
|
+
"mocha": "^10.2.0",
|
|
49
49
|
"npm": "^6.14.5",
|
|
50
50
|
"prettier": "^2.7.1",
|
|
51
51
|
"docdash": "^2.0.1",
|