From bf93e91d879c816a055d5913e6e4210d7299f299 Mon Sep 17 00:00:00 2001 From: isaacs Date: Wed, 21 Aug 2019 16:30:42 -0700 Subject: [PATCH] npm-package-arg@6.1.1 Properly handle git+file: urls on Windows when a drive letter is included. --- node_modules/npm-package-arg/CHANGELOG.md | 10 +++++ node_modules/npm-package-arg/npa.js | 18 ++++++--- node_modules/npm-package-arg/package.json | 45 +++++++++++------------ package-lock.json | 10 ++--- package.json | 2 +- 5 files changed, 50 insertions(+), 35 deletions(-) diff --git a/node_modules/npm-package-arg/CHANGELOG.md b/node_modules/npm-package-arg/CHANGELOG.md index 83e5763f4ffec..1b3431acced77 100644 --- a/node_modules/npm-package-arg/CHANGELOG.md +++ b/node_modules/npm-package-arg/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [6.1.1](https://github.com/npm/npm-package-arg/compare/v6.1.0...v6.1.1) (2019-08-21) + + +### Bug Fixes + +* preserve drive letter on windows git file:// urls ([3909203](https://github.com/npm/npm-package-arg/commit/3909203)) + + + # [6.1.0](https://github.com/npm/npm-package-arg/compare/v6.0.0...v6.1.0) (2018-04-10) diff --git a/node_modules/npm-package-arg/npa.js b/node_modules/npm-package-arg/npa.js index 4d56237a570b9..bf2c17cfd513f 100644 --- a/node_modules/npm-package-arg/npa.js +++ b/node_modules/npm-package-arg/npa.js @@ -6,7 +6,11 @@ module.exports.Result = Result let url let HostedGit let semver -let path +let path_ +function path () { + if (!path_) path_ = require('path') + return path_ +} let validatePackageName let osenv @@ -109,7 +113,6 @@ function Result (opts) { this.gitCommittish = opts.gitCommittish this.hosted = opts.hosted } -Result.prototype = {} Result.prototype.setName = function (name) { if (!validatePackageName) validatePackageName = require('validate-npm-package-name') @@ -152,8 +155,7 @@ const isAbsolutePath = /^[/]|^[A-Za-z]:/ function resolvePath (where, spec) { if (isAbsolutePath.test(spec)) return spec - if (!path) path = require('path') - return path.resolve(where, spec) + return path().resolve(where, spec) } function isAbsolute (dir) { @@ -180,8 +182,7 @@ function fromFile (res, where) { if (isAbsolute(spec)) { res.saveSpec = 'file:' + spec } else { - if (!path) path = require('path') - res.saveSpec = 'file:' + path.relative(where, res.fetchSpec) + res.saveSpec = 'file:' + path().relative(where, res.fetchSpec) } } return res @@ -238,6 +239,11 @@ function fromURL (res) { } else { setGitCommittish(res, urlparse.hash != null ? urlparse.hash.slice(1) : '') urlparse.protocol = urlparse.protocol.replace(/^git[+]/, '') + if (urlparse.protocol === 'file:' && /^git\+file:\/\/[a-z]:/i.test(res.rawSpec)) { + // keep the drive letter : on windows file paths + urlparse.host += ':' + urlparse.hostname += ':' + } delete urlparse.hash res.fetchSpec = url.format(urlparse) } diff --git a/node_modules/npm-package-arg/package.json b/node_modules/npm-package-arg/package.json index 7bd5efeb43f4b..7d978a4d48a5c 100644 --- a/node_modules/npm-package-arg/package.json +++ b/node_modules/npm-package-arg/package.json @@ -1,41 +1,38 @@ { - "_args": [ - [ - "npm-package-arg@6.1.0", - "/Users/rebecca/code/npm" - ] - ], - "_from": "npm-package-arg@6.1.0", - "_id": "npm-package-arg@6.1.0", + "_from": "npm-package-arg@6.1.1", + "_id": "npm-package-arg@6.1.1", "_inBundle": false, - "_integrity": "sha512-zYbhP2k9DbJhA0Z3HKUePUgdB1x7MfIfKssC+WLPFMKTBZKpZh5m13PgexJjCq6KW7j17r0jHWcCpxEqnnncSA==", + "_integrity": "sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg==", "_location": "/npm-package-arg", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "npm-package-arg@6.1.0", + "raw": "npm-package-arg@6.1.1", "name": "npm-package-arg", "escapedName": "npm-package-arg", - "rawSpec": "6.1.0", + "rawSpec": "6.1.1", "saveSpec": null, - "fetchSpec": "6.1.0" + "fetchSpec": "6.1.1" }, "_requiredBy": [ + "#USER", "/", "/init-package-json", "/libcipm", - "/libnpmhook/npm-registry-fetch", + "/libnpm", + "/libnpmaccess", + "/libnpmpublish", "/libnpx", "/lock-verify", "/npm-pick-manifest", - "/npm-registry-client", "/npm-registry-fetch", "/pacote" ], - "_resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.0.tgz", - "_spec": "6.1.0", - "_where": "/Users/rebecca/code/npm", + "_resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz", + "_shasum": "02168cb0a49a2b75bf988a28698de7b529df5cb7", + "_spec": "npm-package-arg@6.1.1", + "_where": "/Users/isaacs/dev/npm/cli", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", @@ -44,17 +41,19 @@ "bugs": { "url": "https://github.com/npm/npm-package-arg/issues" }, + "bundleDependencies": false, "dependencies": { - "hosted-git-info": "^2.6.0", + "hosted-git-info": "^2.7.1", "osenv": "^0.1.5", - "semver": "^5.5.0", + "semver": "^5.6.0", "validate-npm-package-name": "^3.0.0" }, + "deprecated": false, "description": "Parse the things that can be arguments to `npm install`", "devDependencies": { "standard": "^11.0.1", - "standard-version": "^4.3.0", - "tap": "^11.1.3", + "standard-version": "^4.4.0", + "tap": "^12.5.0", "weallbehave": "^1.2.0", "weallcontribute": "^1.0.8" }, @@ -77,9 +76,9 @@ "prerelease": "npm t", "pretest": "standard", "release": "standard-version -s", - "test": "tap -J --coverage test/*.js", + "test": "tap --100 -J --coverage test/*.js", "update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'", "update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'" }, - "version": "6.1.0" + "version": "6.1.1" } diff --git a/package-lock.json b/package-lock.json index 78907aaeca3fa..ea5f763246ad3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3800,13 +3800,13 @@ "integrity": "sha512-AJI/qxDB2PWI4LG1CYN579AY1vCiNyWfkiquCsJWqntRu/WwimVrC8yXeILBFHDwxfOejxewlmnvW9XXjMlYIg==" }, "npm-package-arg": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.0.tgz", - "integrity": "sha512-zYbhP2k9DbJhA0Z3HKUePUgdB1x7MfIfKssC+WLPFMKTBZKpZh5m13PgexJjCq6KW7j17r0jHWcCpxEqnnncSA==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz", + "integrity": "sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg==", "requires": { - "hosted-git-info": "^2.6.0", + "hosted-git-info": "^2.7.1", "osenv": "^0.1.5", - "semver": "^5.5.0", + "semver": "^5.6.0", "validate-npm-package-name": "^3.0.0" } }, diff --git a/package.json b/package.json index c3451f79f8aff..d8e00114979fd 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "npm-cache-filename": "~1.0.2", "npm-install-checks": "~3.0.0", "npm-lifecycle": "^3.1.3", - "npm-package-arg": "^6.1.0", + "npm-package-arg": "^6.1.1", "npm-packlist": "^1.4.4", "npm-pick-manifest": "^3.0.0", "npm-profile": "^4.0.2",