muhammara 2.6.0 → 2.6.2

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/node_modules/@mapbox/node-pre-gyp/CHANGELOG.md +3 -0
  3. package/node_modules/@mapbox/node-pre-gyp/README.md +1 -1
  4. package/node_modules/@mapbox/node-pre-gyp/package.json +5 -5
  5. package/node_modules/semver/classes/range.js +3 -0
  6. package/node_modules/semver/index.js +81 -41
  7. package/node_modules/semver/package.json +25 -14
  8. package/node_modules/tar/README.md +37 -9
  9. package/node_modules/tar/lib/create.js +16 -9
  10. package/node_modules/tar/lib/extract.js +16 -10
  11. package/node_modules/tar/lib/header.js +50 -34
  12. package/node_modules/tar/lib/large-numbers.js +22 -17
  13. package/node_modules/tar/lib/list.js +20 -13
  14. package/node_modules/tar/lib/mkdir.js +40 -24
  15. package/node_modules/tar/lib/mode-fix.js +8 -4
  16. package/node_modules/tar/lib/normalize-unicode.js +3 -2
  17. package/node_modules/tar/lib/pack.js +54 -31
  18. package/node_modules/tar/lib/parse.js +74 -46
  19. package/node_modules/tar/lib/path-reservations.js +26 -18
  20. package/node_modules/tar/lib/pax.js +15 -8
  21. package/node_modules/tar/lib/read-entry.js +14 -7
  22. package/node_modules/tar/lib/replace.js +50 -27
  23. package/node_modules/tar/lib/strip-absolute-path.js +1 -1
  24. package/node_modules/tar/lib/unpack.js +73 -44
  25. package/node_modules/tar/lib/update.js +8 -4
  26. package/node_modules/tar/lib/warn-mixin.js +7 -4
  27. package/node_modules/tar/lib/write-entry.js +44 -23
  28. package/node_modules/tar/package.json +44 -30
  29. package/package.json +1 -1
  30. package/src/deps/PDFWriter/CFFFileInput.cpp +7 -1
  31. package/src/deps/PDFWriter/DecryptionHelper.cpp +1 -1
  32. package/src/deps/PDFWriter/DocumentContext.cpp +21 -8
  33. package/src/deps/PDFWriter/DocumentContext.h +1 -1
  34. package/src/deps/PDFWriter/PDFModifiedPage.cpp +2 -0
  35. package/src/deps/PDFWriter/PDFPageInput.cpp +7 -1
  36. package/src/deps/PDFWriter/PDFParser.cpp +12 -0
  37. package/src/deps/PDFWriter/PDFUsedFont.cpp +4 -2
  38. package/src/deps/PDFWriter/TrueTypeEmbeddedFontWriter.cpp +15 -0
@@ -34,18 +34,21 @@ class Header {
34
34
  this.atime = null
35
35
  this.ctime = null
36
36
 
37
- if (Buffer.isBuffer(data))
37
+ if (Buffer.isBuffer(data)) {
38
38
  this.decode(data, off || 0, ex, gex)
39
- else if (data)
39
+ } else if (data) {
40
40
  this.set(data)
41
+ }
41
42
  }
42
43
 
43
44
  decode (buf, off, ex, gex) {
44
- if (!off)
45
+ if (!off) {
45
46
  off = 0
47
+ }
46
48
 
47
- if (!buf || !(buf.length >= off + 512))
49
+ if (!buf || !(buf.length >= off + 512)) {
48
50
  throw new Error('need 512 bytes for header')
51
+ }
49
52
 
50
53
  this.path = decString(buf, off, 100)
51
54
  this.mode = decNumber(buf, off + 100, 8)
@@ -62,18 +65,21 @@ class Header {
62
65
 
63
66
  // old tar versions marked dirs as a file with a trailing /
64
67
  this[TYPE] = decString(buf, off + 156, 1)
65
- if (this[TYPE] === '')
68
+ if (this[TYPE] === '') {
66
69
  this[TYPE] = '0'
67
- if (this[TYPE] === '0' && this.path.substr(-1) === '/')
70
+ }
71
+ if (this[TYPE] === '0' && this.path.slice(-1) === '/') {
68
72
  this[TYPE] = '5'
73
+ }
69
74
 
70
75
  // tar implementations sometimes incorrectly put the stat(dir).size
71
76
  // as the size in the tarball, even though Directory entries are
72
77
  // not able to have any body at all. In the very rare chance that
73
78
  // it actually DOES have a body, we weren't going to do anything with
74
79
  // it anyway, and it'll just be a warning about an invalid header.
75
- if (this[TYPE] === '5')
80
+ if (this[TYPE] === '5') {
76
81
  this.size = 0
82
+ }
77
83
 
78
84
  this.linkpath = decString(buf, off + 157, 100)
79
85
  if (buf.slice(off + 257, off + 265).toString() === 'ustar\u000000') {
@@ -87,23 +93,27 @@ class Header {
87
93
  this.path = prefix + '/' + this.path
88
94
  } else {
89
95
  const prefix = decString(buf, off + 345, 130)
90
- if (prefix)
96
+ if (prefix) {
91
97
  this.path = prefix + '/' + this.path
98
+ }
92
99
  this.atime = decDate(buf, off + 476, 12)
93
100
  this.ctime = decDate(buf, off + 488, 12)
94
101
  }
95
102
  }
96
103
 
97
104
  let sum = 8 * 0x20
98
- for (let i = off; i < off + 148; i++)
105
+ for (let i = off; i < off + 148; i++) {
99
106
  sum += buf[i]
107
+ }
100
108
 
101
- for (let i = off + 156; i < off + 512; i++)
109
+ for (let i = off + 156; i < off + 512; i++) {
102
110
  sum += buf[i]
111
+ }
103
112
 
104
113
  this.cksumValid = sum === this.cksum
105
- if (this.cksum === null && sum === 8 * 0x20)
114
+ if (this.cksum === null && sum === 8 * 0x20) {
106
115
  this.nullBlock = true
116
+ }
107
117
  }
108
118
 
109
119
  [SLURP] (ex, global) {
@@ -111,8 +121,9 @@ class Header {
111
121
  // we slurp in everything except for the path attribute in
112
122
  // a global extended header, because that's weird.
113
123
  if (ex[k] !== null && ex[k] !== undefined &&
114
- !(global && k === 'path'))
124
+ !(global && k === 'path')) {
115
125
  this[k] = ex[k]
126
+ }
116
127
  }
117
128
  }
118
129
 
@@ -122,11 +133,13 @@ class Header {
122
133
  off = 0
123
134
  }
124
135
 
125
- if (!off)
136
+ if (!off) {
126
137
  off = 0
138
+ }
127
139
 
128
- if (!(buf.length >= off + 512))
140
+ if (!(buf.length >= off + 512)) {
129
141
  throw new Error('need 512 bytes for header')
142
+ }
130
143
 
131
144
  const prefixSize = this.ctime || this.atime ? 130 : 155
132
145
  const split = splitPrefix(this.path || '', prefixSize)
@@ -148,20 +161,22 @@ class Header {
148
161
  this.needPax = encNumber(buf, off + 329, 8, this.devmaj) || this.needPax
149
162
  this.needPax = encNumber(buf, off + 337, 8, this.devmin) || this.needPax
150
163
  this.needPax = encString(buf, off + 345, prefixSize, prefix) || this.needPax
151
- if (buf[off + 475] !== 0)
164
+ if (buf[off + 475] !== 0) {
152
165
  this.needPax = encString(buf, off + 345, 155, prefix) || this.needPax
153
- else {
166
+ } else {
154
167
  this.needPax = encString(buf, off + 345, 130, prefix) || this.needPax
155
168
  this.needPax = encDate(buf, off + 476, 12, this.atime) || this.needPax
156
169
  this.needPax = encDate(buf, off + 488, 12, this.ctime) || this.needPax
157
170
  }
158
171
 
159
172
  let sum = 8 * 0x20
160
- for (let i = off; i < off + 148; i++)
173
+ for (let i = off; i < off + 148; i++) {
161
174
  sum += buf[i]
175
+ }
162
176
 
163
- for (let i = off + 156; i < off + 512; i++)
177
+ for (let i = off + 156; i < off + 512; i++) {
164
178
  sum += buf[i]
179
+ }
165
180
 
166
181
  this.cksum = sum
167
182
  encNumber(buf, off + 148, 8, this.cksum)
@@ -172,8 +187,9 @@ class Header {
172
187
 
173
188
  set (data) {
174
189
  for (const i in data) {
175
- if (data[i] !== null && data[i] !== undefined)
190
+ if (data[i] !== null && data[i] !== undefined) {
176
191
  this[i] = data[i]
192
+ }
177
193
  }
178
194
  }
179
195
 
@@ -186,10 +202,11 @@ class Header {
186
202
  }
187
203
 
188
204
  set type (type) {
189
- if (types.code.has(type))
205
+ if (types.code.has(type)) {
190
206
  this[TYPE] = types.code.get(type)
191
- else
207
+ } else {
192
208
  this[TYPE] = type
209
+ }
193
210
  }
194
211
  }
195
212
 
@@ -200,25 +217,23 @@ const splitPrefix = (p, prefixSize) => {
200
217
  let ret
201
218
  const root = pathModule.parse(p).root || '.'
202
219
 
203
- if (Buffer.byteLength(pp) < pathSize)
220
+ if (Buffer.byteLength(pp) < pathSize) {
204
221
  ret = [pp, prefix, false]
205
- else {
222
+ } else {
206
223
  // first set prefix to the dir, and path to the base
207
224
  prefix = pathModule.dirname(pp)
208
225
  pp = pathModule.basename(pp)
209
226
 
210
227
  do {
211
- // both fit!
212
228
  if (Buffer.byteLength(pp) <= pathSize &&
213
- Buffer.byteLength(prefix) <= prefixSize)
229
+ Buffer.byteLength(prefix) <= prefixSize) {
230
+ // both fit!
214
231
  ret = [pp, prefix, false]
215
-
216
- // prefix fits in prefix, but path doesn't fit in path
217
- else if (Buffer.byteLength(pp) > pathSize &&
218
- Buffer.byteLength(prefix) <= prefixSize)
219
- ret = [pp.substr(0, pathSize - 1), prefix, true]
220
-
221
- else {
232
+ } else if (Buffer.byteLength(pp) > pathSize &&
233
+ Buffer.byteLength(prefix) <= prefixSize) {
234
+ // prefix fits in prefix, but path doesn't fit in path
235
+ ret = [pp.slice(0, pathSize - 1), prefix, true]
236
+ } else {
222
237
  // make path take a bit from prefix
223
238
  pp = pathModule.join(pathModule.basename(prefix), pp)
224
239
  prefix = pathModule.dirname(prefix)
@@ -226,8 +241,9 @@ const splitPrefix = (p, prefixSize) => {
226
241
  } while (prefix !== root && !ret)
227
242
 
228
243
  // at this point, found no resolution, just truncate
229
- if (!ret)
230
- ret = [p.substr(0, pathSize - 1), '', true]
244
+ if (!ret) {
245
+ ret = [p.slice(0, pathSize - 1), '', true]
246
+ }
231
247
  }
232
248
  return ret
233
249
  }
@@ -3,14 +3,15 @@
3
3
  // 0xff for negative, and 0x80 for positive.
4
4
 
5
5
  const encode = (num, buf) => {
6
- if (!Number.isSafeInteger(num))
7
- // The number is so large that javascript cannot represent it with integer
8
- // precision.
6
+ if (!Number.isSafeInteger(num)) {
7
+ // The number is so large that javascript cannot represent it with integer
8
+ // precision.
9
9
  throw Error('cannot encode number outside of javascript safe integer range')
10
- else if (num < 0)
10
+ } else if (num < 0) {
11
11
  encodeNegative(num, buf)
12
- else
12
+ } else {
13
13
  encodePositive(num, buf)
14
+ }
14
15
  return buf
15
16
  }
16
17
 
@@ -30,11 +31,11 @@ const encodeNegative = (num, buf) => {
30
31
  for (var i = buf.length; i > 1; i--) {
31
32
  var byte = num & 0xff
32
33
  num = Math.floor(num / 0x100)
33
- if (flipped)
34
+ if (flipped) {
34
35
  buf[i - 1] = onesComp(byte)
35
- else if (byte === 0)
36
+ } else if (byte === 0) {
36
37
  buf[i - 1] = 0
37
- else {
38
+ } else {
38
39
  flipped = true
39
40
  buf[i - 1] = twosComp(byte)
40
41
  }
@@ -46,13 +47,15 @@ const parse = (buf) => {
46
47
  const value = pre === 0x80 ? pos(buf.slice(1, buf.length))
47
48
  : pre === 0xff ? twos(buf)
48
49
  : null
49
- if (value === null)
50
+ if (value === null) {
50
51
  throw Error('invalid base256 encoding')
52
+ }
51
53
 
52
- if (!Number.isSafeInteger(value))
53
- // The number is so large that javascript cannot represent it with integer
54
- // precision.
54
+ if (!Number.isSafeInteger(value)) {
55
+ // The number is so large that javascript cannot represent it with integer
56
+ // precision.
55
57
  throw Error('parsed number outside of javascript safe integer range')
58
+ }
56
59
 
57
60
  return value
58
61
  }
@@ -64,16 +67,17 @@ const twos = (buf) => {
64
67
  for (var i = len - 1; i > -1; i--) {
65
68
  var byte = buf[i]
66
69
  var f
67
- if (flipped)
70
+ if (flipped) {
68
71
  f = onesComp(byte)
69
- else if (byte === 0)
72
+ } else if (byte === 0) {
70
73
  f = byte
71
- else {
74
+ } else {
72
75
  flipped = true
73
76
  f = twosComp(byte)
74
77
  }
75
- if (f !== 0)
78
+ if (f !== 0) {
76
79
  sum -= f * Math.pow(256, len - i - 1)
80
+ }
77
81
  }
78
82
  return sum
79
83
  }
@@ -83,8 +87,9 @@ const pos = (buf) => {
83
87
  var sum = 0
84
88
  for (var i = len - 1; i > -1; i--) {
85
89
  var byte = buf[i]
86
- if (byte !== 0)
90
+ if (byte !== 0) {
87
91
  sum += byte * Math.pow(256, len - i - 1)
92
+ }
88
93
  }
89
94
  return sum
90
95
  }
@@ -12,32 +12,39 @@ const path = require('path')
12
12
  const stripSlash = require('./strip-trailing-slashes.js')
13
13
 
14
14
  module.exports = (opt_, files, cb) => {
15
- if (typeof opt_ === 'function')
15
+ if (typeof opt_ === 'function') {
16
16
  cb = opt_, files = null, opt_ = {}
17
- else if (Array.isArray(opt_))
17
+ } else if (Array.isArray(opt_)) {
18
18
  files = opt_, opt_ = {}
19
+ }
19
20
 
20
- if (typeof files === 'function')
21
+ if (typeof files === 'function') {
21
22
  cb = files, files = null
23
+ }
22
24
 
23
- if (!files)
25
+ if (!files) {
24
26
  files = []
25
- else
27
+ } else {
26
28
  files = Array.from(files)
29
+ }
27
30
 
28
31
  const opt = hlo(opt_)
29
32
 
30
- if (opt.sync && typeof cb === 'function')
33
+ if (opt.sync && typeof cb === 'function') {
31
34
  throw new TypeError('callback not supported for sync tar functions')
35
+ }
32
36
 
33
- if (!opt.file && typeof cb === 'function')
37
+ if (!opt.file && typeof cb === 'function') {
34
38
  throw new TypeError('callback only supported with file option')
39
+ }
35
40
 
36
- if (files.length)
41
+ if (files.length) {
37
42
  filesFilter(opt, files)
43
+ }
38
44
 
39
- if (!opt.noResume)
45
+ if (!opt.noResume) {
40
46
  onentryFunction(opt)
47
+ }
41
48
 
42
49
  return opt.file && opt.sync ? listFileSync(opt)
43
50
  : opt.file ? listFile(opt, cb)
@@ -81,9 +88,9 @@ const listFileSync = opt => {
81
88
  try {
82
89
  const stat = fs.statSync(file)
83
90
  const readSize = opt.maxReadSize || 16 * 1024 * 1024
84
- if (stat.size < readSize)
91
+ if (stat.size < readSize) {
85
92
  p.end(fs.readFileSync(file))
86
- else {
93
+ } else {
87
94
  let pos = 0
88
95
  const buf = Buffer.allocUnsafe(readSize)
89
96
  fd = fs.openSync(file, 'r')
@@ -114,9 +121,9 @@ const listFile = (opt, cb) => {
114
121
  parse.on('end', resolve)
115
122
 
116
123
  fs.stat(file, (er, stat) => {
117
- if (er)
124
+ if (er) {
118
125
  reject(er)
119
- else {
126
+ } else {
120
127
  const stream = new fsm.ReadStream(file, {
121
128
  readSize: readSize,
122
129
  size: stat.size,
@@ -39,8 +39,9 @@ const cSet = (cache, key, val) => cache.set(normPath(key), val)
39
39
 
40
40
  const checkCwd = (dir, cb) => {
41
41
  fs.stat(dir, (er, st) => {
42
- if (er || !st.isDirectory())
42
+ if (er || !st.isDirectory()) {
43
43
  er = new CwdError(dir, er && er.code || 'ENOTDIR')
44
+ }
44
45
  cb(er)
45
46
  })
46
47
  }
@@ -66,27 +67,31 @@ module.exports = (dir, opt, cb) => {
66
67
  const cwd = normPath(opt.cwd)
67
68
 
68
69
  const done = (er, created) => {
69
- if (er)
70
+ if (er) {
70
71
  cb(er)
71
- else {
72
+ } else {
72
73
  cSet(cache, dir, true)
73
- if (created && doChown)
74
+ if (created && doChown) {
74
75
  chownr(created, uid, gid, er => done(er))
75
- else if (needChmod)
76
+ } else if (needChmod) {
76
77
  fs.chmod(dir, mode, cb)
77
- else
78
+ } else {
78
79
  cb()
80
+ }
79
81
  }
80
82
  }
81
83
 
82
- if (cache && cGet(cache, dir) === true)
84
+ if (cache && cGet(cache, dir) === true) {
83
85
  return done()
86
+ }
84
87
 
85
- if (dir === cwd)
88
+ if (dir === cwd) {
86
89
  return checkCwd(dir, done)
90
+ }
87
91
 
88
- if (preserve)
89
- return mkdirp(dir, {mode}).then(made => done(null, made), done)
92
+ if (preserve) {
93
+ return mkdirp(dir, { mode }).then(made => done(null, made), done)
94
+ }
90
95
 
91
96
  const sub = normPath(path.relative(cwd, dir))
92
97
  const parts = sub.split('/')
@@ -94,12 +99,14 @@ module.exports = (dir, opt, cb) => {
94
99
  }
95
100
 
96
101
  const mkdir_ = (base, parts, mode, cache, unlink, cwd, created, cb) => {
97
- if (!parts.length)
102
+ if (!parts.length) {
98
103
  return cb(null, created)
104
+ }
99
105
  const p = parts.shift()
100
106
  const part = normPath(path.resolve(base + '/' + p))
101
- if (cGet(cache, part))
107
+ if (cGet(cache, part)) {
102
108
  return mkdir_(part, parts, mode, cache, unlink, cwd, created, cb)
109
+ }
103
110
  fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb))
104
111
  }
105
112
 
@@ -109,18 +116,20 @@ const onmkdir = (part, parts, mode, cache, unlink, cwd, created, cb) => er => {
109
116
  if (statEr) {
110
117
  statEr.path = statEr.path && normPath(statEr.path)
111
118
  cb(statEr)
112
- } else if (st.isDirectory())
119
+ } else if (st.isDirectory()) {
113
120
  mkdir_(part, parts, mode, cache, unlink, cwd, created, cb)
114
- else if (unlink) {
121
+ } else if (unlink) {
115
122
  fs.unlink(part, er => {
116
- if (er)
123
+ if (er) {
117
124
  return cb(er)
125
+ }
118
126
  fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb))
119
127
  })
120
- } else if (st.isSymbolicLink())
128
+ } else if (st.isSymbolicLink()) {
121
129
  return cb(new SymlinkError(part, part + '/' + parts.join('/')))
122
- else
130
+ } else {
123
131
  cb(er)
132
+ }
124
133
  })
125
134
  } else {
126
135
  created = created || part
@@ -136,8 +145,9 @@ const checkCwdSync = dir => {
136
145
  } catch (er) {
137
146
  code = er.code
138
147
  } finally {
139
- if (!ok)
148
+ if (!ok) {
140
149
  throw new CwdError(dir, code)
150
+ }
141
151
  }
142
152
  }
143
153
 
@@ -162,22 +172,26 @@ module.exports.sync = (dir, opt) => {
162
172
 
163
173
  const done = (created) => {
164
174
  cSet(cache, dir, true)
165
- if (created && doChown)
175
+ if (created && doChown) {
166
176
  chownr.sync(created, uid, gid)
167
- if (needChmod)
177
+ }
178
+ if (needChmod) {
168
179
  fs.chmodSync(dir, mode)
180
+ }
169
181
  }
170
182
 
171
- if (cache && cGet(cache, dir) === true)
183
+ if (cache && cGet(cache, dir) === true) {
172
184
  return done()
185
+ }
173
186
 
174
187
  if (dir === cwd) {
175
188
  checkCwdSync(cwd)
176
189
  return done()
177
190
  }
178
191
 
179
- if (preserve)
192
+ if (preserve) {
180
193
  return done(mkdirp.sync(dir, mode))
194
+ }
181
195
 
182
196
  const sub = normPath(path.relative(cwd, dir))
183
197
  const parts = sub.split('/')
@@ -186,8 +200,9 @@ module.exports.sync = (dir, opt) => {
186
200
  p && (part += '/' + p);
187
201
  p = parts.shift()) {
188
202
  part = normPath(path.resolve(part))
189
- if (cGet(cache, part))
203
+ if (cGet(cache, part)) {
190
204
  continue
205
+ }
191
206
 
192
207
  try {
193
208
  fs.mkdirSync(part, mode)
@@ -204,8 +219,9 @@ module.exports.sync = (dir, opt) => {
204
219
  created = created || part
205
220
  cSet(cache, part, true)
206
221
  continue
207
- } else if (st.isSymbolicLink())
222
+ } else if (st.isSymbolicLink()) {
208
223
  return new SymlinkError(part, part + '/' + parts.join('/'))
224
+ }
209
225
  }
210
226
  }
211
227
 
@@ -7,17 +7,21 @@ module.exports = (mode, isDir, portable) => {
7
7
  // (as some linux distros do), then we'll write the
8
8
  // archive with 0o644 instead. Also, don't ever create
9
9
  // a file that is not readable/writable by the owner.
10
- if (portable)
10
+ if (portable) {
11
11
  mode = (mode | 0o600) & ~0o22
12
+ }
12
13
 
13
14
  // if dirs are readable, then they should be listable
14
15
  if (isDir) {
15
- if (mode & 0o400)
16
+ if (mode & 0o400) {
16
17
  mode |= 0o100
17
- if (mode & 0o40)
18
+ }
19
+ if (mode & 0o40) {
18
20
  mode |= 0o10
19
- if (mode & 0o4)
21
+ }
22
+ if (mode & 0o4) {
20
23
  mode |= 0o1
24
+ }
21
25
  }
22
26
  return mode
23
27
  }
@@ -3,9 +3,10 @@
3
3
  // within npm install on large package trees.
4
4
  // Do not edit without careful benchmarking.
5
5
  const normalizeCache = Object.create(null)
6
- const {hasOwnProperty} = Object.prototype
6
+ const { hasOwnProperty } = Object.prototype
7
7
  module.exports = s => {
8
- if (!hasOwnProperty.call(normalizeCache, s))
8
+ if (!hasOwnProperty.call(normalizeCache, s)) {
9
9
  normalizeCache[s] = s.normalize('NFKD')
10
+ }
10
11
  return normalizeCache[s]
11
12
  }