Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Karrys <luke@lukekarrys.com>2021-09-02 00:32:47 +0300
committerLuke Karrys <luke@lukekarrys.com>2021-09-02 00:32:47 +0300
commit033e948c95b3455812e03a860ad1bd96a635e7eb (patch)
treeff73d99442f235a12a0bbf6c99a5c2ba1629409f
parent6125db545315da0217fe7b05062fd0a504c9a45b (diff)
deps: read-package-json@4.1.1
* feat: add types lookup * fix(man): don't lose relative man path
-rw-r--r--node_modules/read-package-json/package.json10
-rw-r--r--node_modules/read-package-json/read-json.js51
-rw-r--r--package-lock.json14
-rw-r--r--package.json2
4 files changed, 62 insertions, 15 deletions
diff --git a/node_modules/read-package-json/package.json b/node_modules/read-package-json/package.json
index 5ca535cfd..fb263fd71 100644
--- a/node_modules/read-package-json/package.json
+++ b/node_modules/read-package-json/package.json
@@ -1,6 +1,6 @@
{
"name": "read-package-json",
- "version": "4.0.1",
+ "version": "4.1.1",
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
"description": "The thing npm uses to read package.json files with semantics and defaults and validation",
"repository": {
@@ -12,7 +12,7 @@
"prerelease": "npm t",
"postrelease": "npm publish && git push --follow-tags",
"release": "standard-version -s",
- "test": "tap --nyc-arg=--all --coverage test/*.js --branches 68 --functions 83 --lines 76 --statements 77",
+ "test": "tap --nyc-arg=--all --coverage test/*.js",
"npmclilint": "npmcli-lint",
"lint": "npm run npmclilint -- --ignore-pattern test/fixtures \"*.*js\" \"test/**/*.*js\"",
"lintfix": "npm run lint -- --fix",
@@ -36,5 +36,11 @@
],
"engines": {
"node": ">=10"
+ },
+ "tap": {
+ "branches": 68,
+ "functions": 83,
+ "lines": 76,
+ "statements": 77
}
}
diff --git a/node_modules/read-package-json/read-json.js b/node_modules/read-package-json/read-json.js
index 04d22e3af..468a33e39 100644
--- a/node_modules/read-package-json/read-json.js
+++ b/node_modules/read-package-json/read-json.js
@@ -21,6 +21,7 @@ readJson.extraSet = [
mans,
bins,
githead,
+ fillTypes,
]
var typoWarned = {}
@@ -339,16 +340,17 @@ function readme_ (file, data, rm, cb) {
}
function mans (file, data, cb) {
- var m = data.directories && data.directories.man
- if (data.man || !m) {
+ let cwd = data.directories && data.directories.man
+ if (data.man || !cwd) {
return cb(null, data)
}
- m = path.resolve(path.dirname(file), m)
- glob('**/*.[0-9]', { cwd: m }, function (er, mans) {
+ const dirname = path.dirname(file)
+ cwd = path.resolve(path.dirname(file), cwd)
+ glob('**/*.[0-9]', { cwd }, function (er, mans) {
if (er) {
return cb(er)
}
- data.man = mans
+ data.man = mans.map(man => path.relative(dirname, path.join(cwd, man)))
return cb(null, data)
})
}
@@ -517,6 +519,45 @@ function final (file, data, log, strict, cb) {
})
}
+function fillTypes (file, data, cb) {
+ var index = data.main ? data.main : 'index.js'
+
+ // TODO exports is much more complicated than this in verbose format
+ // We need to support for instance
+
+ // "exports": {
+ // ".": [
+ // {
+ // "default": "./lib/npm.js"
+ // },
+ // "./lib/npm.js"
+ // ],
+ // "./package.json": "./package.json"
+ // },
+ // as well as conditional exports
+
+ // if (data.exports && typeof data.exports === 'string') {
+ // index = data.exports
+ // }
+
+ // if (data.exports && data.exports['.']) {
+ // index = data.exports['.']
+ // if (typeof index !== 'string') {
+ // }
+ // }
+
+ var extless =
+ path.join(path.dirname(index), path.basename(index, path.extname(index)))
+ var dts = `./${extless}.d.ts`
+ var dtsPath = path.join(path.dirname(file), dts)
+ var hasDTSFields = 'types' in data || 'typings' in data
+ if (!hasDTSFields && fs.existsSync(dtsPath)) {
+ data.types = dts
+ }
+
+ cb(null, data)
+}
+
function makePackageId (data) {
var name = cleanString(data.name)
var ver = cleanString(data.version)
diff --git a/package-lock.json b/package-lock.json
index ef2bf7195..1d4f7b360 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -138,7 +138,7 @@
"parse-conflict-json": "^1.1.1",
"qrcode-terminal": "^0.12.0",
"read": "~1.0.7",
- "read-package-json": "^4.0.1",
+ "read-package-json": "^4.1.1",
"read-package-json-fast": "^2.0.3",
"readdir-scoped-modules": "^1.1.0",
"rimraf": "^3.0.2",
@@ -6444,9 +6444,9 @@
"inBundle": true
},
"node_modules/read-package-json": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-4.0.1.tgz",
- "integrity": "sha512-czqCcYfkEl6sIFJVOND/5/Goseu7cVw1rcDUATq6ED0jLGjMm9/HOPmFmEZMvRu9yl272YERaMUcOlvcNU9InQ==",
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-4.1.1.tgz",
+ "integrity": "sha512-P82sbZJ3ldDrWCOSKxJT0r/CXMWR0OR3KRh55SgKo3p91GSIEEC32v3lSHAvO/UcH3/IoL7uqhOFBduAnwdldw==",
"inBundle": true,
"dependencies": {
"glob": "^7.1.1",
@@ -15193,9 +15193,9 @@
"integrity": "sha512-HJpV9bQpkl6KwjxlJcBoqu9Ba0PQg8TqSNIOrulGt54a0uup0HtevreFHzYzkm0lpnleRdNBzXznKrgxglEHQw=="
},
"read-package-json": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-4.0.1.tgz",
- "integrity": "sha512-czqCcYfkEl6sIFJVOND/5/Goseu7cVw1rcDUATq6ED0jLGjMm9/HOPmFmEZMvRu9yl272YERaMUcOlvcNU9InQ==",
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-4.1.1.tgz",
+ "integrity": "sha512-P82sbZJ3ldDrWCOSKxJT0r/CXMWR0OR3KRh55SgKo3p91GSIEEC32v3lSHAvO/UcH3/IoL7uqhOFBduAnwdldw==",
"requires": {
"glob": "^7.1.1",
"json-parse-even-better-errors": "^2.3.0",
diff --git a/package.json b/package.json
index 30877f8de..f769d346e 100644
--- a/package.json
+++ b/package.json
@@ -108,7 +108,7 @@
"parse-conflict-json": "^1.1.1",
"qrcode-terminal": "^0.12.0",
"read": "~1.0.7",
- "read-package-json": "^4.0.1",
+ "read-package-json": "^4.1.1",
"read-package-json-fast": "^2.0.3",
"readdir-scoped-modules": "^1.1.0",
"rimraf": "^3.0.2",