muhammara 3.2.0 → 3.4.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 +37 -2
- package/binding.gyp +2 -2
- package/muhammara.d.ts +1 -1
- package/node_modules/tar/README.md +37 -9
- package/node_modules/tar/lib/create.js +16 -9
- package/node_modules/tar/lib/extract.js +16 -10
- package/node_modules/tar/lib/header.js +50 -34
- package/node_modules/tar/lib/large-numbers.js +22 -17
- package/node_modules/tar/lib/list.js +20 -13
- package/node_modules/tar/lib/mkdir.js +40 -24
- package/node_modules/tar/lib/mode-fix.js +8 -4
- package/node_modules/tar/lib/normalize-unicode.js +3 -2
- package/node_modules/tar/lib/pack.js +54 -31
- package/node_modules/tar/lib/parse.js +74 -46
- package/node_modules/tar/lib/path-reservations.js +26 -18
- package/node_modules/tar/lib/pax.js +15 -8
- package/node_modules/tar/lib/read-entry.js +14 -7
- package/node_modules/tar/lib/replace.js +50 -27
- package/node_modules/tar/lib/strip-absolute-path.js +1 -1
- package/node_modules/tar/lib/unpack.js +73 -44
- package/node_modules/tar/lib/update.js +8 -4
- package/node_modules/tar/lib/warn-mixin.js +7 -4
- package/node_modules/tar/lib/write-entry.js +44 -23
- package/node_modules/tar/package.json +44 -30
- package/package.json +1 -1
- package/src/deps/FreeType/binding.gyp +10 -0
- package/src/deps/LibAesgm/binding.gyp +10 -0
- package/src/deps/LibJpeg/binding.gyp +10 -0
- package/src/deps/LibPng/binding.gyp +11 -1
- package/src/deps/LibTiff/binding.gyp +10 -0
- package/src/deps/PDFWriter/CFFFileInput.cpp +7 -1
- package/src/deps/PDFWriter/DecryptionHelper.cpp +1 -1
- package/src/deps/PDFWriter/DocumentContext.cpp +21 -8
- package/src/deps/PDFWriter/DocumentContext.h +1 -1
- package/src/deps/PDFWriter/PDFModifiedPage.cpp +2 -0
- package/src/deps/PDFWriter/PDFPageInput.cpp +7 -1
- package/src/deps/PDFWriter/PDFParser.cpp +6 -0
- package/src/deps/PDFWriter/PDFUsedFont.cpp +4 -2
- package/src/deps/PDFWriter/TrueTypeEmbeddedFontWriter.cpp +15 -0
- package/src/deps/PDFWriter/binding.gyp +10 -0
- package/src/deps/ZLib/binding.gyp +10 -0
|
@@ -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
|
-
|
|
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
|
-
|
|
18
|
+
}
|
|
19
|
+
if (mode & 0o40) {
|
|
18
20
|
mode |= 0o10
|
|
19
|
-
|
|
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
|
}
|
|
@@ -73,23 +73,27 @@ const Pack = warner(class Pack extends MiniPass {
|
|
|
73
73
|
this.readdirCache = opt.readdirCache || new Map()
|
|
74
74
|
|
|
75
75
|
this[WRITEENTRYCLASS] = WriteEntry
|
|
76
|
-
if (typeof opt.onwarn === 'function')
|
|
76
|
+
if (typeof opt.onwarn === 'function') {
|
|
77
77
|
this.on('warn', opt.onwarn)
|
|
78
|
+
}
|
|
78
79
|
|
|
79
80
|
this.portable = !!opt.portable
|
|
80
81
|
this.zip = null
|
|
81
82
|
if (opt.gzip) {
|
|
82
|
-
if (typeof opt.gzip !== 'object')
|
|
83
|
+
if (typeof opt.gzip !== 'object') {
|
|
83
84
|
opt.gzip = {}
|
|
84
|
-
|
|
85
|
+
}
|
|
86
|
+
if (this.portable) {
|
|
85
87
|
opt.gzip.portable = true
|
|
88
|
+
}
|
|
86
89
|
this.zip = new zlib.Gzip(opt.gzip)
|
|
87
90
|
this.zip.on('data', chunk => super.write(chunk))
|
|
88
91
|
this.zip.on('end', _ => super.end())
|
|
89
92
|
this.zip.on('drain', _ => this[ONDRAIN]())
|
|
90
93
|
this.on('resume', _ => this.zip.resume())
|
|
91
|
-
} else
|
|
94
|
+
} else {
|
|
92
95
|
this.on('drain', this[ONDRAIN])
|
|
96
|
+
}
|
|
93
97
|
|
|
94
98
|
this.noDirRecurse = !!opt.noDirRecurse
|
|
95
99
|
this.follow = !!opt.follow
|
|
@@ -115,30 +119,33 @@ const Pack = warner(class Pack extends MiniPass {
|
|
|
115
119
|
}
|
|
116
120
|
|
|
117
121
|
end (path) {
|
|
118
|
-
if (path)
|
|
122
|
+
if (path) {
|
|
119
123
|
this.write(path)
|
|
124
|
+
}
|
|
120
125
|
this[ENDED] = true
|
|
121
126
|
this[PROCESS]()
|
|
122
127
|
return this
|
|
123
128
|
}
|
|
124
129
|
|
|
125
130
|
write (path) {
|
|
126
|
-
if (this[ENDED])
|
|
131
|
+
if (this[ENDED]) {
|
|
127
132
|
throw new Error('write after end')
|
|
133
|
+
}
|
|
128
134
|
|
|
129
|
-
if (path instanceof ReadEntry)
|
|
135
|
+
if (path instanceof ReadEntry) {
|
|
130
136
|
this[ADDTARENTRY](path)
|
|
131
|
-
else
|
|
137
|
+
} else {
|
|
132
138
|
this[ADDFSENTRY](path)
|
|
139
|
+
}
|
|
133
140
|
return this.flowing
|
|
134
141
|
}
|
|
135
142
|
|
|
136
143
|
[ADDTARENTRY] (p) {
|
|
137
144
|
const absolute = normPath(path.resolve(this.cwd, p.path))
|
|
138
145
|
// in this case, we don't have to wait for the stat
|
|
139
|
-
if (!this.filter(p.path, p))
|
|
146
|
+
if (!this.filter(p.path, p)) {
|
|
140
147
|
p.resume()
|
|
141
|
-
else {
|
|
148
|
+
} else {
|
|
142
149
|
const job = new PackJob(p.path, absolute, false)
|
|
143
150
|
job.entry = new WriteEntryTar(p, this[ENTRYOPT](job))
|
|
144
151
|
job.entry.on('end', _ => this[JOBDONE](job))
|
|
@@ -162,10 +169,11 @@ const Pack = warner(class Pack extends MiniPass {
|
|
|
162
169
|
fs[stat](job.absolute, (er, stat) => {
|
|
163
170
|
job.pending = false
|
|
164
171
|
this[JOBS] -= 1
|
|
165
|
-
if (er)
|
|
172
|
+
if (er) {
|
|
166
173
|
this.emit('error', er)
|
|
167
|
-
else
|
|
174
|
+
} else {
|
|
168
175
|
this[ONSTAT](job, stat)
|
|
176
|
+
}
|
|
169
177
|
})
|
|
170
178
|
}
|
|
171
179
|
|
|
@@ -174,8 +182,9 @@ const Pack = warner(class Pack extends MiniPass {
|
|
|
174
182
|
job.stat = stat
|
|
175
183
|
|
|
176
184
|
// now we have the stat, we can filter it.
|
|
177
|
-
if (!this.filter(job.path, stat))
|
|
185
|
+
if (!this.filter(job.path, stat)) {
|
|
178
186
|
job.ignore = true
|
|
187
|
+
}
|
|
179
188
|
|
|
180
189
|
this[PROCESS]()
|
|
181
190
|
}
|
|
@@ -186,8 +195,9 @@ const Pack = warner(class Pack extends MiniPass {
|
|
|
186
195
|
fs.readdir(job.absolute, (er, entries) => {
|
|
187
196
|
job.pending = false
|
|
188
197
|
this[JOBS] -= 1
|
|
189
|
-
if (er)
|
|
198
|
+
if (er) {
|
|
190
199
|
return this.emit('error', er)
|
|
200
|
+
}
|
|
191
201
|
this[ONREADDIR](job, entries)
|
|
192
202
|
})
|
|
193
203
|
}
|
|
@@ -199,8 +209,9 @@ const Pack = warner(class Pack extends MiniPass {
|
|
|
199
209
|
}
|
|
200
210
|
|
|
201
211
|
[PROCESS] () {
|
|
202
|
-
if (this[PROCESSING])
|
|
212
|
+
if (this[PROCESSING]) {
|
|
203
213
|
return
|
|
214
|
+
}
|
|
204
215
|
|
|
205
216
|
this[PROCESSING] = true
|
|
206
217
|
for (let w = this[QUEUE].head;
|
|
@@ -217,9 +228,9 @@ const Pack = warner(class Pack extends MiniPass {
|
|
|
217
228
|
this[PROCESSING] = false
|
|
218
229
|
|
|
219
230
|
if (this[ENDED] && !this[QUEUE].length && this[JOBS] === 0) {
|
|
220
|
-
if (this.zip)
|
|
231
|
+
if (this.zip) {
|
|
221
232
|
this.zip.end(EOF)
|
|
222
|
-
else {
|
|
233
|
+
} else {
|
|
223
234
|
super.write(EOF)
|
|
224
235
|
super.end()
|
|
225
236
|
}
|
|
@@ -237,35 +248,42 @@ const Pack = warner(class Pack extends MiniPass {
|
|
|
237
248
|
}
|
|
238
249
|
|
|
239
250
|
[PROCESSJOB] (job) {
|
|
240
|
-
if (job.pending)
|
|
251
|
+
if (job.pending) {
|
|
241
252
|
return
|
|
253
|
+
}
|
|
242
254
|
|
|
243
255
|
if (job.entry) {
|
|
244
|
-
if (job === this[CURRENT] && !job.piped)
|
|
256
|
+
if (job === this[CURRENT] && !job.piped) {
|
|
245
257
|
this[PIPE](job)
|
|
258
|
+
}
|
|
246
259
|
return
|
|
247
260
|
}
|
|
248
261
|
|
|
249
262
|
if (!job.stat) {
|
|
250
|
-
if (this.statCache.has(job.absolute))
|
|
263
|
+
if (this.statCache.has(job.absolute)) {
|
|
251
264
|
this[ONSTAT](job, this.statCache.get(job.absolute))
|
|
252
|
-
else
|
|
265
|
+
} else {
|
|
253
266
|
this[STAT](job)
|
|
267
|
+
}
|
|
254
268
|
}
|
|
255
|
-
if (!job.stat)
|
|
269
|
+
if (!job.stat) {
|
|
256
270
|
return
|
|
271
|
+
}
|
|
257
272
|
|
|
258
273
|
// filtered out!
|
|
259
|
-
if (job.ignore)
|
|
274
|
+
if (job.ignore) {
|
|
260
275
|
return
|
|
276
|
+
}
|
|
261
277
|
|
|
262
278
|
if (!this.noDirRecurse && job.stat.isDirectory() && !job.readdir) {
|
|
263
|
-
if (this.readdirCache.has(job.absolute))
|
|
279
|
+
if (this.readdirCache.has(job.absolute)) {
|
|
264
280
|
this[ONREADDIR](job, this.readdirCache.get(job.absolute))
|
|
265
|
-
else
|
|
281
|
+
} else {
|
|
266
282
|
this[READDIR](job)
|
|
267
|
-
|
|
283
|
+
}
|
|
284
|
+
if (!job.readdir) {
|
|
268
285
|
return
|
|
286
|
+
}
|
|
269
287
|
}
|
|
270
288
|
|
|
271
289
|
// we know it doesn't have an entry, because that got checked above
|
|
@@ -275,8 +293,9 @@ const Pack = warner(class Pack extends MiniPass {
|
|
|
275
293
|
return
|
|
276
294
|
}
|
|
277
295
|
|
|
278
|
-
if (job === this[CURRENT] && !job.piped)
|
|
296
|
+
if (job === this[CURRENT] && !job.piped) {
|
|
279
297
|
this[PIPE](job)
|
|
298
|
+
}
|
|
280
299
|
}
|
|
281
300
|
|
|
282
301
|
[ENTRYOPT] (job) {
|
|
@@ -309,8 +328,9 @@ const Pack = warner(class Pack extends MiniPass {
|
|
|
309
328
|
}
|
|
310
329
|
|
|
311
330
|
[ONDRAIN] () {
|
|
312
|
-
if (this[CURRENT] && this[CURRENT].entry)
|
|
331
|
+
if (this[CURRENT] && this[CURRENT].entry) {
|
|
313
332
|
this[CURRENT].entry.resume()
|
|
333
|
+
}
|
|
314
334
|
}
|
|
315
335
|
|
|
316
336
|
// like .pipe() but using super, because our write() is special
|
|
@@ -330,20 +350,23 @@ const Pack = warner(class Pack extends MiniPass {
|
|
|
330
350
|
|
|
331
351
|
if (zip) {
|
|
332
352
|
source.on('data', chunk => {
|
|
333
|
-
if (!zip.write(chunk))
|
|
353
|
+
if (!zip.write(chunk)) {
|
|
334
354
|
source.pause()
|
|
355
|
+
}
|
|
335
356
|
})
|
|
336
357
|
} else {
|
|
337
358
|
source.on('data', chunk => {
|
|
338
|
-
if (!super.write(chunk))
|
|
359
|
+
if (!super.write(chunk)) {
|
|
339
360
|
source.pause()
|
|
361
|
+
}
|
|
340
362
|
})
|
|
341
363
|
}
|
|
342
364
|
}
|
|
343
365
|
|
|
344
366
|
pause () {
|
|
345
|
-
if (this.zip)
|
|
367
|
+
if (this.zip) {
|
|
346
368
|
this.zip.pause()
|
|
369
|
+
}
|
|
347
370
|
return super.pause()
|
|
348
371
|
}
|
|
349
372
|
})
|