Skip to content

Commit 952fbed

Browse files
committed
1 parent dd43d30 commit 952fbed

File tree

109 files changed

+7686
-65
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+7686
-65
lines changed

node_modules/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@
242242
!/read-cmd-shim
243243
!/read-package-json-fast
244244
!/read-package-json
245+
!/read-package-json/node_modules/
246+
/read-package-json/node_modules/*
247+
!/read-package-json/node_modules/glob
248+
!/read-package-json/node_modules/minimatch
245249
!/read
246250
!/readable-stream
247251
!/retry

node_modules/read-package-json/lib/read-json.js

+35-52
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,12 @@ function gypfile (file, data, cb) {
218218
return cb(null, data)
219219
}
220220

221-
glob('*.gyp', { cwd: dir }, function (er, files) {
222-
if (er) {
223-
return cb(er)
224-
}
225-
if (data.gypfile === false) {
226-
return cb(null, data)
227-
}
228-
gypfile_(file, data, files, cb)
229-
})
221+
if (data.gypfile === false) {
222+
return cb(null, data)
223+
}
224+
glob('*.gyp', { cwd: dir })
225+
.then(files => gypfile_(file, data, files, cb))
226+
.catch(er => cb(er))
230227
}
231228

232229
function gypfile_ (file, data, files, cb) {
@@ -246,22 +243,13 @@ function serverjs (file, data, cb) {
246243
if (s.start) {
247244
return cb(null, data)
248245
}
249-
glob('server.js', { cwd: dir }, function (er, files) {
250-
if (er) {
251-
return cb(er)
246+
fs.access(path.join(dir, 'server.js'), (err) => {
247+
if (!err) {
248+
s.start = 'node server.js'
249+
data.scripts = s
252250
}
253-
serverjs_(file, data, files, cb)
254-
})
255-
}
256-
257-
function serverjs_ (file, data, files, cb) {
258-
if (!files.length) {
259251
return cb(null, data)
260-
}
261-
var s = data.scripts || {}
262-
s.start = 'node server.js'
263-
data.scripts = s
264-
return cb(null, data)
252+
})
265253
}
266254

267255
function authors (file, data, cb) {
@@ -294,21 +282,20 @@ function readme (file, data, cb) {
294282
}
295283
var dir = path.dirname(file)
296284
var globOpts = { cwd: dir, nocase: true, mark: true }
297-
glob('{README,README.*}', globOpts, function (er, files) {
298-
if (er) {
299-
return cb(er)
300-
}
301-
// don't accept directories.
302-
files = files.filter(function (filtered) {
303-
return !filtered.match(/\/$/)
285+
glob('{README,README.*}', globOpts)
286+
.then(files => {
287+
// don't accept directories.
288+
files = files.filter(function (filtered) {
289+
return !filtered.match(/\/$/)
290+
})
291+
if (!files.length) {
292+
return cb()
293+
}
294+
var fn = preferMarkdownReadme(files)
295+
var rm = path.resolve(dir, fn)
296+
return readme_(file, data, rm, cb)
304297
})
305-
if (!files.length) {
306-
return cb()
307-
}
308-
var fn = preferMarkdownReadme(files)
309-
var rm = path.resolve(dir, fn)
310-
readme_(file, data, rm, cb)
311-
})
298+
.catch(er => cb(er))
312299
}
313300

314301
function preferMarkdownReadme (files) {
@@ -346,15 +333,14 @@ function mans (file, data, cb) {
346333
}
347334
const dirname = path.dirname(file)
348335
cwd = path.resolve(path.dirname(file), cwd)
349-
glob('**/*.[0-9]', { cwd }, function (er, mansGlob) {
350-
if (er) {
351-
return cb(er)
352-
}
353-
data.man = mansGlob.map(man =>
354-
path.relative(dirname, path.join(cwd, man)).split(path.sep).join('/')
355-
)
356-
return cb(null, data)
357-
})
336+
glob('**/*.[0-9]', { cwd })
337+
.then(mansGlob => {
338+
data.man = mansGlob.map(man =>
339+
path.relative(dirname, path.join(cwd, man)).split(path.sep).join('/')
340+
)
341+
return cb(null, data)
342+
})
343+
.catch(er => cb(er))
358344
}
359345

360346
function bins (file, data, cb) {
@@ -366,12 +352,9 @@ function bins (file, data, cb) {
366352
}
367353

368354
m = path.resolve(path.dirname(file), m)
369-
glob('**', { cwd: m }, function (er, binsGlob) {
370-
if (er) {
371-
return cb(er)
372-
}
373-
bins_(file, data, binsGlob, cb)
374-
})
355+
glob('**', { cwd: m })
356+
.then(binsGlob => bins_(file, data, binsGlob, cb))
357+
.catch(er => cb(er))
375358
}
376359

377360
function bins_ (file, data, binsGlob, cb) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
The ISC License
2+
3+
Copyright (c) 2009-2023 Isaac Z. Schlueter and Contributors
4+
5+
Permission to use, copy, modify, and/or distribute this software for any
6+
purpose with or without fee is hereby granted, provided that the above
7+
copyright notice and this permission notice appear in all copies.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
15+
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

0 commit comments

Comments
 (0)