Comparing version 11.5.0 to 11.6.0
@@ -5,2 +5,18 @@ # Change Log | ||
<a name="11.6.0"></a> | ||
# [11.6.0](https://github.com/istanbuljs/nyc/compare/v11.5.0...v11.6.0) (2018-03-13) | ||
### Bug Fixes | ||
* removes unused split-lines dependency. ([#787](https://github.com/istanbuljs/nyc/issues/787)) ([b4032ce](https://github.com/istanbuljs/nyc/commit/b4032ce)) | ||
* update to yargs version that allows extending configs with no extension ([#790](https://github.com/istanbuljs/nyc/issues/790)) ([2d51562](https://github.com/istanbuljs/nyc/commit/2d51562)) | ||
### Features | ||
* allow usage of ignoreClassMethods from istanbul ([#785](https://github.com/istanbuljs/nyc/issues/785)) ([c6b30ba](https://github.com/istanbuljs/nyc/commit/c6b30ba)) | ||
<a name="11.5.0"></a> | ||
@@ -7,0 +23,0 @@ # [11.5.0](https://github.com/istanbuljs/nyc/compare/v11.4.1...v11.5.0) (2018-02-13) |
@@ -139,2 +139,3 @@ /* global __coverage__ */ | ||
return this._instrumenterLib(this.cwd, { | ||
ignoreClassMethods: [].concat(this.config.ignoreClassMethod).filter(a => a), | ||
produceSourceMap: this.config.produceSourceMap, | ||
@@ -141,0 +142,0 @@ compact: this.config.compact, |
@@ -15,2 +15,3 @@ 'use strict' | ||
produceSourceMap: options.produceSourceMap, | ||
ignoreClassMethods: options.ignoreClassMethods, | ||
esModules: true | ||
@@ -17,0 +18,0 @@ }) |
@@ -20,3 +20,2 @@ { | ||
"/has-ansi", | ||
"/inquirer", | ||
"/strip-ansi" | ||
@@ -23,0 +22,0 @@ ], |
@@ -19,3 +19,4 @@ { | ||
"_requiredBy": [ | ||
"/arr-diff" | ||
"/arr-diff", | ||
"/test-exclude/braces" | ||
], | ||
@@ -22,0 +23,0 @@ "_resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", |
@@ -20,3 +20,2 @@ { | ||
"/", | ||
"/globby", | ||
"/test-exclude" | ||
@@ -23,0 +22,0 @@ ], |
@@ -19,4 +19,3 @@ { | ||
"_requiredBy": [ | ||
"/babel-traverse", | ||
"/eslint" | ||
"/babel-traverse" | ||
], | ||
@@ -23,0 +22,0 @@ "_resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", |
@@ -19,10 +19,3 @@ { | ||
"_requiredBy": [ | ||
"/babel-code-frame", | ||
"/eslint", | ||
"/har-validator", | ||
"/inline-source-map-comment", | ||
"/inquirer", | ||
"/standard-version", | ||
"/sum-up", | ||
"/table" | ||
"/babel-code-frame" | ||
], | ||
@@ -29,0 +22,0 @@ "_resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", |
@@ -19,5 +19,2 @@ { | ||
"_requiredBy": [ | ||
"/inquirer/string-width", | ||
"/readline2", | ||
"/standard-version/cliui/string-width", | ||
"/wrap-ansi/string-width" | ||
@@ -24,0 +21,0 @@ ], |
@@ -19,4 +19,3 @@ { | ||
"_requiredBy": [ | ||
"/", | ||
"/pkg-config" | ||
"/" | ||
], | ||
@@ -23,0 +22,0 @@ "_resolved": "https://registry.npmjs.org/debug-log/-/debug-log-1.0.1.tgz", |
@@ -20,4 +20,4 @@ { | ||
"/babel-traverse", | ||
"/eslint", | ||
"/tap-mocha-reporter" | ||
"/snapdragon", | ||
"/test-exclude/expand-brackets" | ||
], | ||
@@ -24,0 +24,0 @@ "_resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", |
@@ -19,4 +19,2 @@ { | ||
"_requiredBy": [ | ||
"/meow", | ||
"/standard-version/yargs", | ||
"/uglify-js/yargs", | ||
@@ -23,0 +21,0 @@ "/yargs" |
@@ -19,4 +19,3 @@ { | ||
"_requiredBy": [ | ||
"/parse-json", | ||
"/pkg-conf/parse-json" | ||
"/parse-json" | ||
], | ||
@@ -23,0 +22,0 @@ "_resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", |
@@ -19,6 +19,3 @@ { | ||
"_requiredBy": [ | ||
"/chalk", | ||
"/figures", | ||
"/mocha", | ||
"/tap-mocha-reporter" | ||
"/chalk" | ||
], | ||
@@ -25,0 +22,0 @@ "_resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", |
@@ -20,6 +20,3 @@ { | ||
"/babel-code-frame", | ||
"/babel-types", | ||
"/doctrine", | ||
"/eslint", | ||
"/eslint-plugin-react/doctrine" | ||
"/babel-types" | ||
], | ||
@@ -26,0 +23,0 @@ "_resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", |
@@ -8,3 +8,3 @@ { | ||
"_phantomChildren": { | ||
"lru-cache": "4.1.1", | ||
"lru-cache": "4.1.2", | ||
"shebang-command": "1.2.0", | ||
@@ -11,0 +11,0 @@ "which": "1.3.0" |
@@ -20,5 +20,2 @@ { | ||
"/", | ||
"/dotgitignore", | ||
"/pkg-conf", | ||
"/standard-version/read-pkg-up", | ||
"/yargs" | ||
@@ -25,0 +22,0 @@ ], |
@@ -19,3 +19,4 @@ { | ||
"_requiredBy": [ | ||
"/for-own" | ||
"/for-own", | ||
"/mixin-deep" | ||
], | ||
@@ -22,0 +23,0 @@ "_resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", |
@@ -20,4 +20,3 @@ { | ||
"/", | ||
"/spawn-wrap", | ||
"/tap" | ||
"/spawn-wrap" | ||
], | ||
@@ -24,0 +23,0 @@ "_resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-1.5.6.tgz", |
@@ -19,4 +19,3 @@ { | ||
"_requiredBy": [ | ||
"/glob", | ||
"/mocha/glob" | ||
"/glob" | ||
], | ||
@@ -23,0 +22,0 @@ "_resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", |
@@ -19,3 +19,2 @@ { | ||
"_requiredBy": [ | ||
"/standard-version/yargs", | ||
"/yargs" | ||
@@ -22,0 +21,0 @@ ], |
@@ -20,9 +20,3 @@ { | ||
"/", | ||
"/deglob", | ||
"/eslint", | ||
"/globby", | ||
"/rimraf", | ||
"/shelljs", | ||
"/tap", | ||
"/tap-mocha-reporter" | ||
"/rimraf" | ||
], | ||
@@ -29,0 +23,0 @@ "_resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", |
@@ -19,4 +19,3 @@ { | ||
"_requiredBy": [ | ||
"/babel-traverse", | ||
"/eslint" | ||
"/babel-traverse" | ||
], | ||
@@ -23,0 +22,0 @@ "_resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", |
@@ -19,7 +19,4 @@ { | ||
"_requiredBy": [ | ||
"/flat-cache", | ||
"/load-json-file", | ||
"/path-type", | ||
"/pkg-conf/load-json-file", | ||
"/standard-version/load-json-file", | ||
"/write-file-atomic" | ||
@@ -26,0 +23,0 @@ ], |
@@ -21,3 +21,2 @@ { | ||
"_requiredBy": [ | ||
"/conventional-changelog-writer", | ||
"/istanbul-reports" | ||
@@ -24,0 +23,0 @@ ], |
@@ -19,4 +19,3 @@ { | ||
"_requiredBy": [ | ||
"/istanbul-lib-report/supports-color", | ||
"/mocha/supports-color" | ||
"/istanbul-lib-report/supports-color" | ||
], | ||
@@ -23,0 +22,0 @@ "_resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", |
@@ -39,2 +39,3 @@ 'use strict' | ||
'browsetemplate': 'https://{domain}/{project}{/committish}', | ||
'browsefiletemplate': 'https://{domain}/{project}{/committish}{#path}', | ||
'docstemplate': 'https://{domain}/{project}{/committish}', | ||
@@ -44,3 +45,6 @@ 'httpstemplate': 'git+https://{domain}/{project}.git{#committish}', | ||
'pathtemplate': '{project}{#committish}', | ||
'tarballtemplate': 'https://{domain}/{user}/{project}/archive/{committish}.tar.gz' | ||
'tarballtemplate': 'https://{domain}/{user}/{project}/archive/{committish}.tar.gz', | ||
'hashformat': function (fragment) { | ||
return 'file-' + formatHashFragment(fragment) | ||
} | ||
} | ||
@@ -53,2 +57,3 @@ } | ||
'browsetemplate': 'https://{domain}/{user}/{project}{/tree/committish}', | ||
'browsefiletemplate': 'https://{domain}/{user}/{project}/{treepath}/{committish}/{path}{#fragment}', | ||
'docstemplate': 'https://{domain}/{user}/{project}{/tree/committish}#readme', | ||
@@ -59,3 +64,4 @@ 'httpstemplate': 'git+https://{auth@}{domain}/{user}/{project}.git{#committish}', | ||
'pathtemplate': '{user}/{project}{#committish}', | ||
'pathmatch': /^[/]([^/]+)[/]([^/]+?)(?:[.]git|[/])?$/ | ||
'pathmatch': /^[/]([^/]+)[/]([^/]+?)(?:[.]git|[/])?$/, | ||
'hashformat': formatHashFragment | ||
} | ||
@@ -73,1 +79,5 @@ | ||
}) | ||
function formatHashFragment (fragment) { | ||
return fragment.toLowerCase().replace(/^\W+|\/|\W+$/g, '').replace(/\W+/g, '-') | ||
} |
'use strict' | ||
var gitHosts = require('./git-host-info.js') | ||
var extend = Object.assign || require('util')._extend | ||
@@ -26,4 +25,5 @@ var GitHost = module.exports = function (type, user, auth, project, committish, defaultRepresentation, opts) { | ||
if (!template) return | ||
var vars = extend({}, opts) | ||
opts = extend(extend({}, this.opts), opts) | ||
var vars = Object.assign({}, opts) | ||
vars.path = vars.path ? vars.path.replace(/^[/]+/g, '') : '' | ||
opts = Object.assign({}, this.opts, opts) | ||
var self = this | ||
@@ -35,2 +35,4 @@ Object.keys(this).forEach(function (key) { | ||
var rawComittish = vars.committish | ||
var rawFragment = vars.fragment | ||
var rawPath = vars.path | ||
Object.keys(vars).forEach(function (key) { | ||
@@ -40,2 +42,6 @@ vars[key] = encodeURIComponent(vars[key]) | ||
vars['auth@'] = rawAuth ? rawAuth + '@' : '' | ||
vars['#fragment'] = rawFragment ? '#' + this.hashformat(rawFragment) : '' | ||
vars.fragment = vars.fragment ? vars.fragment : '' | ||
vars['#path'] = rawPath ? '#' + this.hashformat(rawPath) : '' | ||
vars['/path'] = vars.path ? '/' + vars.path : '' | ||
if (opts.noCommittish) { | ||
@@ -73,4 +79,15 @@ vars['#committish'] = '' | ||
GitHost.prototype.browse = function (opts) { | ||
return this._fill(this.browsetemplate, opts) | ||
GitHost.prototype.browse = function (P, F, opts) { | ||
if (typeof P === 'string') { | ||
if (typeof F !== 'string') { | ||
opts = F | ||
F = null | ||
} | ||
return this._fill(this.browsefiletemplate, Object.assign({ | ||
fragment: F, | ||
path: P | ||
}, opts)) | ||
} else { | ||
return this._fill(this.browsetemplate, P) | ||
} | ||
} | ||
@@ -107,5 +124,3 @@ | ||
GitHost.prototype.file = function (P, opts) { | ||
return this._fill(this.filetemplate, extend({ | ||
path: P.replace(/^[/]+/g, '') | ||
}, opts)) | ||
return this._fill(this.filetemplate, Object.assign({ path: P }, opts)) | ||
} | ||
@@ -112,0 +127,0 @@ |
{ | ||
"_from": "hosted-git-info@^2.1.4", | ||
"_id": "hosted-git-info@2.5.0", | ||
"_id": "hosted-git-info@2.6.0", | ||
"_inBundle": false, | ||
"_integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", | ||
"_integrity": "sha512-lIbgIIQA3lz5XaB6vxakj6sDHADJiZadYEJB+FgA+C4nubM1NwcuvUr9EJPmnH1skZqpqUzWborWo8EIUi0Sdw==", | ||
"_location": "/hosted-git-info", | ||
@@ -19,7 +19,6 @@ "_phantomChildren": {}, | ||
"_requiredBy": [ | ||
"/get-pkg-repo", | ||
"/normalize-package-data" | ||
], | ||
"_resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", | ||
"_shasum": "6d60e34b3abbc8313062c3b798ef8d901a07af3c", | ||
"_resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.6.0.tgz", | ||
"_shasum": "23235b29ab230c576aab0d4f13fc046b0b038222", | ||
"_spec": "hosted-git-info@^2.1.4", | ||
@@ -40,4 +39,8 @@ "_where": "/Users/benjamincoe/bcoe/nyc/node_modules/normalize-package-data", | ||
"standard": "^9.0.2", | ||
"standard-version": "^4.3.0", | ||
"tap": "^10.3.0" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"files": [ | ||
@@ -63,5 +66,9 @@ "index.js", | ||
"scripts": { | ||
"test": "standard && tap -J --coverage test/*.js" | ||
"postrelease": "npm publish && git push --follow-tags", | ||
"prerelease": "npm t", | ||
"pretest": "standard", | ||
"release": "standard-version -s", | ||
"test": "tap -J --nyc-arg=--all --coverage test" | ||
}, | ||
"version": "2.5.0" | ||
"version": "2.6.0" | ||
} |
@@ -80,5 +80,7 @@ # hosted-git-info | ||
* info.browse(opts) | ||
* info.browse(path, fragment, opts) | ||
eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0` | ||
eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0`, | ||
`https://github.com/npm/hosted-git-info/tree/v1.2.0/package.json`, | ||
`https://github.com/npm/hosted-git-info/tree/v1.2.0/REAMDE.md#supported-hosts` | ||
@@ -133,2 +135,1 @@ * info.bugs(opts) | ||
additional hosts welcome. | ||
@@ -19,3 +19,2 @@ { | ||
"_requiredBy": [ | ||
"/eslint", | ||
"/write-file-atomic" | ||
@@ -22,0 +21,0 @@ ], |
@@ -19,4 +19,3 @@ { | ||
"_requiredBy": [ | ||
"/glob", | ||
"/mocha/glob" | ||
"/glob" | ||
], | ||
@@ -23,0 +22,0 @@ "_resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", |
@@ -19,6 +19,3 @@ { | ||
"_requiredBy": [ | ||
"/concat-stream", | ||
"/glob", | ||
"/mocha/glob", | ||
"/readable-stream" | ||
"/glob" | ||
], | ||
@@ -25,0 +22,0 @@ "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", |
/** | ||
* Copyright 2013-2015, Facebook, Inc. | ||
* All rights reserved. | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
@@ -9,0 +7,0 @@ |
/** | ||
* Copyright 2013-2015, Facebook, Inc. | ||
* All rights reserved. | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
@@ -9,0 +7,0 @@ |
{ | ||
"_from": "invariant@^2.2.2", | ||
"_id": "invariant@2.2.2", | ||
"_id": "invariant@2.2.3", | ||
"_inBundle": false, | ||
"_integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", | ||
"_integrity": "sha512-7Z5PPegwDTyjbaeCnV0efcyS6vdKAU51kpEmS7QFib3P4822l8ICYyMn7qvJnc+WzLoDsuI9gPMKbJ8pCu8XtA==", | ||
"_location": "/invariant", | ||
@@ -21,4 +21,4 @@ "_phantomChildren": {}, | ||
], | ||
"_resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", | ||
"_shasum": "9e1f56ac0acdb6bf303306f338be3b204ae60360", | ||
"_resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.3.tgz", | ||
"_shasum": "1a827dfde7dcbd7c323f0ca826be8fa7c5e9d688", | ||
"_spec": "invariant@^2.2.2", | ||
@@ -60,3 +60,3 @@ "_where": "/Users/benjamincoe/bcoe/nyc/node_modules/babel-traverse", | ||
], | ||
"license": "BSD-3-Clause", | ||
"license": "MIT", | ||
"main": "invariant.js", | ||
@@ -71,3 +71,3 @@ "name": "invariant", | ||
}, | ||
"version": "2.2.2" | ||
"version": "2.2.3" | ||
} |
@@ -37,2 +37,2 @@ # invariant | ||
The node version is optimized around the performance implications of accessing `process.env`. The value of `process.env.NODE_ENV` is cached, and repeatedly used instead of reading `proces.env`. See [Server rendering is slower with npm react #812](https://github.com/facebook/react/issues/812) | ||
The node version is optimized around the performance implications of accessing `process.env`. The value of `process.env.NODE_ENV` is cached, and repeatedly used instead of reading `process.env`. See [Server rendering is slower with npm react #812](https://github.com/facebook/react/issues/812) |
@@ -19,5 +19,16 @@ { | ||
"_requiredBy": [ | ||
"/class-utils/is-accessor-descriptor/kind-of", | ||
"/class-utils/is-data-descriptor/kind-of", | ||
"/has-values/is-number/kind-of", | ||
"/has-values/kind-of", | ||
"/kind-of", | ||
"/randomatic/is-number/kind-of", | ||
"/randomatic/kind-of" | ||
"/randomatic/kind-of", | ||
"/snapdragon/is-accessor-descriptor/kind-of", | ||
"/snapdragon/is-data-descriptor/kind-of", | ||
"/static-extend/is-accessor-descriptor/kind-of", | ||
"/static-extend/is-data-descriptor/kind-of", | ||
"/test-exclude/is-accessor-descriptor/kind-of", | ||
"/test-exclude/is-data-descriptor/kind-of", | ||
"/test-exclude/is-number/kind-of" | ||
], | ||
@@ -24,0 +35,0 @@ "_resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", |
@@ -19,3 +19,13 @@ { | ||
"_requiredBy": [ | ||
"/object.omit" | ||
"/object.omit", | ||
"/set-value", | ||
"/set-value/extend-shallow", | ||
"/snapdragon/extend-shallow", | ||
"/test-exclude/braces/extend-shallow", | ||
"/test-exclude/expand-brackets/extend-shallow", | ||
"/test-exclude/extglob/extend-shallow", | ||
"/test-exclude/fill-range/extend-shallow", | ||
"/union-value", | ||
"/union-value/extend-shallow", | ||
"/union-value/set-value" | ||
], | ||
@@ -22,0 +32,0 @@ "_resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", |
@@ -19,5 +19,4 @@ { | ||
"_requiredBy": [ | ||
"/eslint-plugin-react/doctrine", | ||
"/isobject", | ||
"/readable-stream" | ||
"/unset-value/has-value/isobject" | ||
], | ||
@@ -24,0 +23,0 @@ "_resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", |
@@ -19,3 +19,2 @@ { | ||
"_requiredBy": [ | ||
"/tap", | ||
"/which" | ||
@@ -22,0 +21,0 @@ ], |
@@ -6,2 +6,13 @@ # Change Log | ||
<a name="1.2.0"></a> | ||
# [1.2.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@1.1.2...istanbul-lib-coverage@1.2.0) (2018-03-04) | ||
### Features | ||
* add skip-empty option for html & text reports ([#140](https://github.com/istanbuljs/istanbuljs/issues/140)) ([d2a4262](https://github.com/istanbuljs/istanbuljs/commit/d2a4262)) | ||
<a name="1.1.2"></a> | ||
@@ -8,0 +19,0 @@ ## [1.1.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@1.1.1...istanbul-lib-coverage@1.1.2) (2018-02-13) |
@@ -99,2 +99,9 @@ /* | ||
/** | ||
* return true if summary has no lines of code | ||
*/ | ||
CoverageSummary.prototype.isEmpty = function () { | ||
return this.lines.total === 0; | ||
}; | ||
// returns a data object that represents empty coverage | ||
@@ -101,0 +108,0 @@ function emptyCoverage(filePath) { |
{ | ||
"_from": "istanbul-lib-coverage@^1.1.2", | ||
"_id": "istanbul-lib-coverage@1.1.2", | ||
"_id": "istanbul-lib-coverage@1.2.0", | ||
"_inBundle": false, | ||
"_integrity": "sha512-tZYA0v5A7qBSsOzcebJJ/z3lk3oSzH62puG78DbBA1+zupipX2CakDyiPV3pOb8He+jBwVimuwB0dTnh38hX0w==", | ||
"_integrity": "sha512-GvgM/uXRwm+gLlvkWHTjDAvwynZkL9ns15calTrmhGgowlwJBbWMYzWbKqE2DT6JDP1AFXKa+Zi0EkqNCUqY0A==", | ||
"_location": "/istanbul-lib-coverage", | ||
@@ -24,4 +24,4 @@ "_phantomChildren": {}, | ||
], | ||
"_resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.2.tgz", | ||
"_shasum": "4113c8ff6b7a40a1ef7350b01016331f63afde14", | ||
"_resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-1.2.0.tgz", | ||
"_shasum": "f7d8f2e42b97e37fe796114cb0f9d68b5e3a4341", | ||
"_spec": "istanbul-lib-coverage@^1.1.2", | ||
@@ -75,3 +75,3 @@ "_where": "/Users/benjamincoe/bcoe/nyc", | ||
}, | ||
"version": "1.1.2" | ||
"version": "1.2.0" | ||
} |
@@ -6,2 +6,24 @@ # Change Log | ||
<a name="1.10.1"></a> | ||
## [1.10.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.10.0...istanbul-lib-instrument@1.10.1) (2018-03-09) | ||
### Bug Fixes | ||
* default value for ignorelassMethods ([#151](https://github.com/istanbuljs/istanbuljs/issues/151)) ([5dd88e8](https://github.com/istanbuljs/istanbuljs/commit/5dd88e8)) | ||
<a name="1.10.0"></a> | ||
# [1.10.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.9.2...istanbul-lib-instrument@1.10.0) (2018-03-04) | ||
### Features | ||
* allows an array of ignored method names to be provided ([#127](https://github.com/istanbuljs/istanbuljs/issues/127)) ([67918e2](https://github.com/istanbuljs/istanbuljs/commit/67918e2)) | ||
<a name="1.9.2"></a> | ||
@@ -8,0 +30,0 @@ ## [1.9.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.9.1...istanbul-lib-instrument@1.9.2) (2018-02-13) |
@@ -47,2 +47,3 @@ 'use strict'; | ||
produceSourceMap: false, | ||
ignoreClassMethods: [], | ||
sourceMapUrlCallback: null, | ||
@@ -64,2 +65,3 @@ debug: false | ||
* @param {boolean} [opts.produceSourceMap=false] set to true to produce a source map for the instrumented code. | ||
* @param {Array} [opts.ignoreClassMethods=[]] set to array of class method names to ignore for coverage. | ||
* @param {Function} [opts.sourceMapUrlCallback=null] a callback function that is called when a source map URL | ||
@@ -130,2 +132,3 @@ * is found in the original code. This function is called with the source file name and the source map URL. | ||
coverageVariable: opts.coverageVariable, | ||
ignoreClassMethods: opts.ignoreClassMethods, | ||
inputSourceMap: inputSourceMap | ||
@@ -132,0 +135,0 @@ }); |
@@ -42,2 +42,4 @@ 'use strict'; | ||
function VisitState(types, sourceFilePath, inputSourceMap) { | ||
var ignoreClassMethods = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; | ||
_classCallCheck(this, VisitState); | ||
@@ -53,2 +55,3 @@ | ||
} | ||
this.ignoreClassMethods = ignoreClassMethods; | ||
this.types = types; | ||
@@ -140,2 +143,16 @@ this.sourceMappingURL = null; | ||
} | ||
// else check for ignored class methods | ||
if (path.isFunctionExpression() && this.ignoreClassMethods.some(function (name) { | ||
return path.node.id && name === path.node.id.name; | ||
})) { | ||
this.nextIgnore = n; | ||
return; | ||
} | ||
if (path.isClassMethod() && this.ignoreClassMethods.some(function (name) { | ||
return name === path.node.key.name; | ||
})) { | ||
this.nextIgnore = n; | ||
return; | ||
} | ||
} | ||
@@ -530,2 +547,8 @@ | ||
} | ||
var defaultProgramVisitorOpts = { | ||
coverageVariable: '__coverage__', | ||
ignoreClassMethods: [], | ||
inputSourceMap: undefined | ||
}; | ||
/** | ||
@@ -548,2 +571,3 @@ * programVisitor is a `babel` adaptor for instrumentation. | ||
* @param {string} [opts.coverageVariable=__coverage__] the global coverage variable name. | ||
* @param {Array} [opts.ignoreClassMethods=[]] names of methods to ignore by default on classes. | ||
* @param {object} [opts.inputSourceMap=undefined] the input source map, that maps the uninstrumented code back to the | ||
@@ -554,6 +578,6 @@ * original code. | ||
var sourceFilePath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'unknown.js'; | ||
var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { coverageVariable: '__coverage__', inputSourceMap: undefined }; | ||
var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultProgramVisitorOpts; | ||
var T = types; | ||
var visitState = new VisitState(types, sourceFilePath, opts.inputSourceMap); | ||
var visitState = new VisitState(types, sourceFilePath, opts.inputSourceMap, opts.ignoreClassMethods); | ||
return { | ||
@@ -560,0 +584,0 @@ enter: function enter(path) { |
{ | ||
"_from": "istanbul-lib-instrument@^1.9.2", | ||
"_id": "istanbul-lib-instrument@1.9.2", | ||
"_from": "istanbul-lib-instrument@^1.10.0", | ||
"_id": "istanbul-lib-instrument@1.10.1", | ||
"_inBundle": false, | ||
"_integrity": "sha512-nz8t4HQ2206a/3AXi+NHFWEa844DMpPsgbcUteJbt1j8LX1xg56H9rOMnhvcvVvPbW60qAIyrSk44H8ZDqaSSA==", | ||
"_integrity": "sha512-1dYuzkOCbuR5GRJqySuZdsmsNKPL3PTuyPevQfoCXJePT9C8y1ga75neU+Tuy9+yS3G/dgx8wgOmp2KLpgdoeQ==", | ||
"_location": "/istanbul-lib-instrument", | ||
@@ -11,8 +11,8 @@ "_phantomChildren": {}, | ||
"registry": true, | ||
"raw": "istanbul-lib-instrument@^1.9.2", | ||
"raw": "istanbul-lib-instrument@^1.10.0", | ||
"name": "istanbul-lib-instrument", | ||
"escapedName": "istanbul-lib-instrument", | ||
"rawSpec": "^1.9.2", | ||
"rawSpec": "^1.10.0", | ||
"saveSpec": null, | ||
"fetchSpec": "^1.9.2" | ||
"fetchSpec": "^1.10.0" | ||
}, | ||
@@ -22,5 +22,5 @@ "_requiredBy": [ | ||
], | ||
"_resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-1.9.2.tgz", | ||
"_shasum": "84905bf47f7e0b401d6b840da7bad67086b4aab6", | ||
"_spec": "istanbul-lib-instrument@^1.9.2", | ||
"_resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-1.10.1.tgz", | ||
"_shasum": "724b4b6caceba8692d3f1f9d0727e279c401af7b", | ||
"_spec": "istanbul-lib-instrument@^1.10.0", | ||
"_where": "/Users/benjamincoe/bcoe/nyc", | ||
@@ -41,3 +41,3 @@ "author": { | ||
"babylon": "^6.18.0", | ||
"istanbul-lib-coverage": "^1.1.2", | ||
"istanbul-lib-coverage": "^1.2.0", | ||
"semver": "^5.3.0" | ||
@@ -85,3 +85,3 @@ }, | ||
}, | ||
"version": "1.9.2" | ||
"version": "1.10.1" | ||
} |
@@ -6,2 +6,30 @@ # Change Log | ||
<a name="1.3.0"></a> | ||
# [1.3.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@1.2.0...istanbul-reports@1.3.0) (2018-03-09) | ||
### Features | ||
* added named anchors to code coverage line numbers. ([#149](https://github.com/istanbuljs/istanbuljs/issues/149)) ([98e1c50](https://github.com/istanbuljs/istanbuljs/commit/98e1c50)) | ||
<a name="1.2.0"></a> | ||
# [1.2.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@1.1.4...istanbul-reports@1.2.0) (2018-03-04) | ||
### Bug Fixes | ||
* update fixtures to reflect new heading ([36801d3](https://github.com/istanbuljs/istanbuljs/commit/36801d3)) | ||
### Features | ||
* add skip-empty option for html & text reports ([#140](https://github.com/istanbuljs/istanbuljs/issues/140)) ([d2a4262](https://github.com/istanbuljs/istanbuljs/commit/d2a4262)) | ||
* add uncovered block navigation ([#136](https://github.com/istanbuljs/istanbuljs/issues/136)) ([c798930](https://github.com/istanbuljs/istanbuljs/commit/c798930)) | ||
<a name="1.1.4"></a> | ||
@@ -8,0 +36,0 @@ ## [1.1.4](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@1.1.3...istanbul-reports@1.1.4) (2018-02-13) |
@@ -59,3 +59,4 @@ /* | ||
for (i = 0; i < maxLines; i += 1) { | ||
array[i] = i + 1; | ||
var nextNum = i + 1; | ||
array[i] = "<a name='L" + nextNum + "'></a><a href='#L" + nextNum + "'>" + nextNum + "</a>"; | ||
} | ||
@@ -62,0 +63,0 @@ return array.join('\n'); |
@@ -60,3 +60,9 @@ /* | ||
'</div>' | ||
].join('\n'); | ||
].join('\n'), | ||
emptyClasses = { | ||
statements: 'empty', | ||
lines: 'empty', | ||
functions: 'empty', | ||
branches: 'empty' | ||
}; | ||
@@ -129,2 +135,5 @@ helpers.registerHelpers(handlebars); | ||
}; | ||
templateData.blockNavigation = { | ||
js: linkMapper.assetPath(node, 'block-navigation.js'), | ||
}; | ||
templateData.prettify = { | ||
@@ -141,2 +150,3 @@ js: linkMapper.assetPath(node, 'prettify.js'), | ||
this.date = Date(); | ||
this.skipEmpty = opts.skipEmpty; | ||
} | ||
@@ -180,2 +190,9 @@ | ||
function fixPct(metrics) { | ||
Object.keys(emptyClasses).forEach(function(key) { | ||
metrics[key].pct = 0; | ||
}); | ||
return metrics; | ||
} | ||
HtmlReport.prototype.onSummary = function (node, context) { | ||
@@ -185,2 +202,3 @@ var linkMapper = this.linkMapper, | ||
children = node.getChildren(), | ||
skipEmpty = this.skipEmpty, | ||
cw; | ||
@@ -194,3 +212,5 @@ | ||
var metrics = child.getCoverageSummary(), | ||
reportClasses = { | ||
isEmpty = metrics.isEmpty(); | ||
if (skipEmpty && isEmpty) { return; } | ||
var reportClasses = isEmpty ? emptyClasses : { | ||
statements: context.classForPercent('statements', metrics.statements.pct), | ||
@@ -202,3 +222,3 @@ lines: context.classForPercent('lines', metrics.lines.pct), | ||
data = { | ||
metrics: metrics, | ||
metrics: isEmpty ? fixPct(metrics) : metrics, | ||
reportClasses: reportClasses, | ||
@@ -205,0 +225,0 @@ file: child.getRelativeName(), |
@@ -19,3 +19,4 @@ <div class='push'></div><!-- for sticky footer --> | ||
<script src="{{sorter.js}}"></script> | ||
<script src="{{blockNavigation.js}}"></script> | ||
</body> | ||
</html> |
@@ -59,3 +59,6 @@ <!doctype html> | ||
</div> | ||
<p class="quiet"> | ||
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block. | ||
</p> | ||
</div> | ||
<div class='status-line {{reportClass}}'></div> |
@@ -130,12 +130,14 @@ /* | ||
function tableRow(node, context, colorizer, maxNameCols, level) { | ||
function tableRow(node, context, colorizer, maxNameCols, level, skipEmpty) { | ||
var name = nodeName(node), | ||
metrics = node.getCoverageSummary(), | ||
mm = { | ||
statements: metrics.statements.pct, | ||
branches: metrics.branches.pct, | ||
functions: metrics.functions.pct, | ||
lines: metrics.lines.pct, | ||
isEmpty = metrics.isEmpty(); | ||
if (skipEmpty && isEmpty) { return ''; } | ||
var mm = { | ||
statements: isEmpty ? 0 : metrics.statements.pct, | ||
branches: isEmpty ? 0 : metrics.branches.pct, | ||
functions: isEmpty ? 0 : metrics.functions.pct, | ||
lines: isEmpty ? 0 : metrics.lines.pct, | ||
}, | ||
colorize = function (str, key) { | ||
colorize = isEmpty ? function(str){ return str; } : function (str, key) { | ||
return colorizer(str, context.classForPercent(key, mm[key])); | ||
@@ -163,2 +165,3 @@ }, | ||
this.cw = null; | ||
this.skipEmpty = opts.skipEmpty; | ||
} | ||
@@ -187,3 +190,4 @@ | ||
var nodeDepth = depthFor(node); | ||
this.cw.println(tableRow(node, context, this.cw.colorize.bind(this.cw),this.nameWidth, nodeDepth)); | ||
var row = tableRow(node, context, this.cw.colorize.bind(this.cw),this.nameWidth, nodeDepth, this.skipEmpty); | ||
if (row) { this.cw.println(row); } | ||
}; | ||
@@ -190,0 +194,0 @@ |
{ | ||
"_from": "istanbul-reports@^1.1.4", | ||
"_id": "istanbul-reports@1.1.4", | ||
"_id": "istanbul-reports@1.3.0", | ||
"_inBundle": false, | ||
"_integrity": "sha512-DfSTVOTkuO+kRmbO8Gk650Wqm1WRGr6lrdi2EwDK1vxpS71vdlLd613EpzOKdIFioB5f/scJTjeWBnvd1FWejg==", | ||
"_integrity": "sha512-y2Z2IMqE1gefWUaVjrBm0mSKvUkaBy9Vqz8iwr/r40Y9hBbIteH5wqHG/9DLTfJ9xUnUT2j7A3+VVJ6EaYBllA==", | ||
"_location": "/istanbul-reports", | ||
@@ -21,4 +21,4 @@ "_phantomChildren": {}, | ||
], | ||
"_resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-1.1.4.tgz", | ||
"_shasum": "5ccba5e22b7b5a5d91d5e0a830f89be334bf97bd", | ||
"_resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-1.3.0.tgz", | ||
"_shasum": "2f322e81e1d9520767597dca3c20a0cce89a3554", | ||
"_spec": "istanbul-reports@^1.1.4", | ||
@@ -42,4 +42,4 @@ "_where": "/Users/benjamincoe/bcoe/nyc", | ||
"is-windows": "^1.0.1", | ||
"istanbul-lib-coverage": "^1.1.2", | ||
"istanbul-lib-report": "^1.1.3", | ||
"istanbul-lib-coverage": "^1.2.0", | ||
"istanbul-lib-report": "^1.1.4", | ||
"jshint": "^2.8.0", | ||
@@ -68,3 +68,3 @@ "mocha": "^3.1.2" | ||
}, | ||
"version": "1.1.4" | ||
"version": "1.3.0" | ||
} |
@@ -21,3 +21,9 @@ { | ||
"/is-number", | ||
"/micromatch" | ||
"/micromatch", | ||
"/object-copy", | ||
"/object-copy/is-accessor-descriptor", | ||
"/object-copy/is-data-descriptor", | ||
"/snapdragon-util", | ||
"/to-object-path", | ||
"/to-regex-range/is-number" | ||
], | ||
@@ -24,0 +30,0 @@ "_resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", |
@@ -23,9 +23,3 @@ { | ||
"/babel-traverse", | ||
"/babel-types", | ||
"/conventional-changelog-core", | ||
"/conventional-changelog-writer", | ||
"/conventional-commits-parser", | ||
"/eslint", | ||
"/inquirer", | ||
"/table" | ||
"/babel-types" | ||
], | ||
@@ -32,0 +26,0 @@ "_resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz", |
{ | ||
"_from": "lru-cache@^4.0.1", | ||
"_id": "lru-cache@4.1.1", | ||
"_id": "lru-cache@4.1.2", | ||
"_inBundle": false, | ||
"_integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", | ||
"_integrity": "sha512-wgeVXhrDwAWnIF/yZARsFnMBtdFXOg1b8RIrhilp+0iDYN4mdQcNZElDZ0e4B64BhaxeQ5zN7PMyvu7we1kPeQ==", | ||
"_location": "/lru-cache", | ||
@@ -22,4 +22,4 @@ "_phantomChildren": {}, | ||
], | ||
"_resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", | ||
"_shasum": "622e32e82488b49279114a4f9ecf45e7cd6bba55", | ||
"_resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.2.tgz", | ||
"_shasum": "45234b2e6e2f2b33da125624c4664929a0224c3f", | ||
"_spec": "lru-cache@^4.0.1", | ||
@@ -69,3 +69,3 @@ "_where": "/Users/benjamincoe/bcoe/nyc/node_modules/cross-spawn", | ||
}, | ||
"version": "4.1.1" | ||
"version": "4.1.2" | ||
} |
@@ -28,6 +28,12 @@ # lru cache | ||
// non-string keys ARE fully supported | ||
var someObject = {} | ||
// but note that it must be THE SAME object, not | ||
// just a JSON-equivalent object. | ||
var someObject = { a: 1 } | ||
cache.set(someObject, 'a value') | ||
// Object keys are not toString()-ed | ||
cache.set('[object Object]', 'a different value') | ||
assert.equal(cache.get(someObject), 'a value') | ||
// A similar object with same keys/values won't work, | ||
// because it's a different object identity | ||
assert.equal(cache.get({ a: 1 }), undefined) | ||
@@ -34,0 +40,0 @@ cache.reset() // empty the cache |
@@ -19,4 +19,3 @@ { | ||
"_requiredBy": [ | ||
"/", | ||
"/test-exclude" | ||
"/" | ||
], | ||
@@ -23,0 +22,0 @@ "_resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", |
@@ -19,5 +19,3 @@ { | ||
"_requiredBy": [ | ||
"/dotgitignore", | ||
"/glob", | ||
"/mocha/glob" | ||
"/glob" | ||
], | ||
@@ -24,0 +22,0 @@ "_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", |
@@ -21,9 +21,6 @@ { | ||
"/caching-transform", | ||
"/eslint", | ||
"/find-cache-dir", | ||
"/istanbul-lib-report", | ||
"/istanbul-lib-source-maps", | ||
"/mocha", | ||
"/spawn-wrap", | ||
"/write" | ||
"/spawn-wrap" | ||
], | ||
@@ -30,0 +27,0 @@ "_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", |
@@ -20,4 +20,3 @@ { | ||
"/debug", | ||
"/istanbul-lib-source-maps/debug", | ||
"/mocha/debug" | ||
"/istanbul-lib-source-maps/debug" | ||
], | ||
@@ -24,0 +23,0 @@ "_resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", |
@@ -19,7 +19,3 @@ { | ||
"_requiredBy": [ | ||
"/conventional-changelog-core", | ||
"/get-pkg-repo", | ||
"/meow", | ||
"/read-pkg", | ||
"/standard-version/read-pkg" | ||
"/read-pkg" | ||
], | ||
@@ -26,0 +22,0 @@ "_resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", |
@@ -19,7 +19,3 @@ { | ||
"_requiredBy": [ | ||
"/dargs", | ||
"/inquirer/is-fullwidth-code-point", | ||
"/is-finite", | ||
"/readline2/is-fullwidth-code-point", | ||
"/standard-version/is-fullwidth-code-point", | ||
"/wrap-ansi/is-fullwidth-code-point" | ||
@@ -26,0 +22,0 @@ ], |
@@ -19,9 +19,2 @@ { | ||
"_requiredBy": [ | ||
"/conventional-recommended-bump", | ||
"/del", | ||
"/esrecurse", | ||
"/figures", | ||
"/file-entry-cache", | ||
"/globby", | ||
"/meow", | ||
"/test-exclude" | ||
@@ -28,0 +21,0 @@ ], |
@@ -20,5 +20,3 @@ { | ||
"/glob", | ||
"/inflight", | ||
"/mocha/glob", | ||
"/run-async" | ||
"/inflight" | ||
], | ||
@@ -25,0 +23,0 @@ "_resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", |
@@ -19,6 +19,3 @@ { | ||
"_requiredBy": [ | ||
"/home-or-tmp", | ||
"/spawn-wrap", | ||
"/tap", | ||
"/user-home" | ||
"/spawn-wrap" | ||
], | ||
@@ -25,0 +22,0 @@ "_resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", |
@@ -19,3 +19,2 @@ { | ||
"_requiredBy": [ | ||
"/standard-version/yargs", | ||
"/yargs" | ||
@@ -22,0 +21,0 @@ ], |
@@ -19,4 +19,3 @@ { | ||
"_requiredBy": [ | ||
"/load-json-file", | ||
"/standard-version/load-json-file" | ||
"/load-json-file" | ||
], | ||
@@ -23,0 +22,0 @@ "_resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", |
@@ -19,4 +19,3 @@ { | ||
"_requiredBy": [ | ||
"/glob", | ||
"/mocha/glob" | ||
"/glob" | ||
], | ||
@@ -23,0 +22,0 @@ "_resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", |
@@ -19,4 +19,3 @@ { | ||
"_requiredBy": [ | ||
"/istanbul-lib-report", | ||
"/resolve" | ||
"/istanbul-lib-report" | ||
], | ||
@@ -23,0 +22,0 @@ "_resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", |
@@ -19,9 +19,4 @@ { | ||
"_requiredBy": [ | ||
"/del", | ||
"/git-remote-origin-url", | ||
"/globby", | ||
"/load-json-file", | ||
"/path-type", | ||
"/standard-version/load-json-file", | ||
"/standard-version/path-type" | ||
"/path-type" | ||
], | ||
@@ -28,0 +23,0 @@ "_resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", |
@@ -19,5 +19,2 @@ { | ||
"_requiredBy": [ | ||
"/del", | ||
"/globby", | ||
"/har-validator", | ||
"/load-json-file", | ||
@@ -24,0 +21,0 @@ "/path-exists", |
@@ -22,4 +22,2 @@ { | ||
"_requiredBy": [ | ||
"/conventional-changelog-core", | ||
"/meow", | ||
"/test-exclude" | ||
@@ -26,0 +24,0 @@ ], |
@@ -19,3 +19,2 @@ { | ||
"_requiredBy": [ | ||
"/conventional-changelog-core", | ||
"/read-pkg-up" | ||
@@ -22,0 +21,0 @@ ], |
@@ -20,3 +20,4 @@ { | ||
"/braces", | ||
"/fill-range" | ||
"/fill-range", | ||
"/test-exclude/braces" | ||
], | ||
@@ -23,0 +24,0 @@ "_resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", |
@@ -20,3 +20,5 @@ { | ||
"/align-text", | ||
"/fill-range" | ||
"/fill-range", | ||
"/test-exclude/fill-range", | ||
"/to-regex-range" | ||
], | ||
@@ -23,0 +25,0 @@ "_resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", |
@@ -19,4 +19,3 @@ { | ||
"_requiredBy": [ | ||
"/detect-indent", | ||
"/indent-string" | ||
"/detect-indent" | ||
], | ||
@@ -23,0 +22,0 @@ "_resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", |
@@ -19,3 +19,2 @@ { | ||
"_requiredBy": [ | ||
"/standard-version/yargs", | ||
"/yargs" | ||
@@ -22,0 +21,0 @@ ], |
@@ -19,3 +19,2 @@ { | ||
"_requiredBy": [ | ||
"/standard-version/yargs", | ||
"/test-exclude", | ||
@@ -22,0 +21,0 @@ "/yargs" |
@@ -20,3 +20,2 @@ { | ||
"/", | ||
"/del", | ||
"/istanbul-lib-source-maps", | ||
@@ -23,0 +22,0 @@ "/spawn-wrap" |
@@ -19,7 +19,4 @@ { | ||
"_requiredBy": [ | ||
"/conventional-changelog-writer", | ||
"/git-semver-tags", | ||
"/istanbul-lib-instrument", | ||
"/normalize-package-data", | ||
"/standard-version" | ||
"/normalize-package-data" | ||
], | ||
@@ -26,0 +23,0 @@ "_resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", |
@@ -19,3 +19,2 @@ { | ||
"_requiredBy": [ | ||
"/standard-version/yargs", | ||
"/yargs" | ||
@@ -22,0 +21,0 @@ ], |
@@ -22,5 +22,3 @@ { | ||
"/foreground-child", | ||
"/loud-rejection", | ||
"/spawn-wrap", | ||
"/tap" | ||
"/spawn-wrap" | ||
], | ||
@@ -27,0 +25,0 @@ "_resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", |
@@ -21,4 +21,3 @@ { | ||
"/istanbul-lib-source-maps", | ||
"/recast", | ||
"/source-map-support", | ||
"/snapdragon", | ||
"/uglify-js" | ||
@@ -25,0 +24,0 @@ ], |
@@ -1,5 +0,26 @@ | ||
var licenseIDs = require('spdx-license-ids'); | ||
/* | ||
Copyright 2015 Kyle E. Mitchell | ||
function valid(string) { | ||
return licenseIDs.indexOf(string) > -1; | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
var parse = require('spdx-expression-parse') | ||
var spdxLicenseIds = require('spdx-license-ids') | ||
function valid (string) { | ||
try { | ||
parse(string) | ||
return true | ||
} catch (error) { | ||
return false | ||
} | ||
} | ||
@@ -33,6 +54,6 @@ | ||
['-License', ''] | ||
]; | ||
] | ||
var TRANSPOSED = 0; | ||
var CORRECT = 1; | ||
var TRANSPOSED = 0 | ||
var CORRECT = 1 | ||
@@ -42,81 +63,91 @@ // Simple corrections to nearly valid identifiers. | ||
// e.g. 'mit' | ||
function(argument) { | ||
return argument.toUpperCase(); | ||
function (argument) { | ||
return argument.toUpperCase() | ||
}, | ||
// e.g. 'MIT ' | ||
function(argument) { | ||
return argument.trim(); | ||
function (argument) { | ||
return argument.trim() | ||
}, | ||
// e.g. 'M.I.T.' | ||
function(argument) { | ||
return argument.replace(/\./g, ''); | ||
function (argument) { | ||
return argument.replace(/\./g, '') | ||
}, | ||
// e.g. 'Apache- 2.0' | ||
function(argument) { | ||
return argument.replace(/\s+/g, ''); | ||
function (argument) { | ||
return argument.replace(/\s+/g, '') | ||
}, | ||
// e.g. 'CC BY 4.0'' | ||
function(argument) { | ||
return argument.replace(/\s+/g, '-'); | ||
function (argument) { | ||
return argument.replace(/\s+/g, '-') | ||
}, | ||
// e.g. 'LGPLv2.1' | ||
function(argument) { | ||
return argument.replace('v', '-'); | ||
function (argument) { | ||
return argument.replace('v', '-') | ||
}, | ||
// e.g. 'Apache 2.0' | ||
function(argument) { | ||
return argument.replace(/,?\s*(\d)/, '-$1'); | ||
function (argument) { | ||
return argument.replace(/,?\s*(\d)/, '-$1') | ||
}, | ||
// e.g. 'GPL 2' | ||
function(argument) { | ||
return argument.replace(/,?\s*(\d)/, '-$1.0'); | ||
function (argument) { | ||
return argument.replace(/,?\s*(\d)/, '-$1.0') | ||
}, | ||
// e.g. 'Apache Version 2.0' | ||
function(argument) { | ||
return argument.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/, '-$2'); | ||
function (argument) { | ||
return argument | ||
.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/, '-$2') | ||
}, | ||
// e.g. 'Apache Version 2' | ||
function(argument) { | ||
return argument.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/, '-$2.0'); | ||
function (argument) { | ||
return argument | ||
.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/, '-$2.0') | ||
}, | ||
// e.g. 'ZLIB' | ||
function(argument) { | ||
return argument[0].toUpperCase() + argument.slice(1); | ||
function (argument) { | ||
return argument[0].toUpperCase() + argument.slice(1) | ||
}, | ||
// e.g. 'MPL/2.0' | ||
function(argument) { | ||
return argument.replace('/', '-'); | ||
function (argument) { | ||
return argument.replace('/', '-') | ||
}, | ||
// e.g. 'Apache 2' | ||
function(argument) { | ||
function (argument) { | ||
return argument | ||
.replace(/\s*V\s*(\d)/, '-$1') | ||
.replace(/(\d)$/, '$1.0'); | ||
.replace(/(\d)$/, '$1.0') | ||
}, | ||
// e.g. 'GPL-2.0', 'GPL-3.0' | ||
function (argument) { | ||
if (argument.indexOf('3.0') !== -1) { | ||
return argument + '-or-later' | ||
} else { | ||
return argument + '-only' | ||
} | ||
}, | ||
// e.g. 'GPL-2.0-' | ||
function(argument) { | ||
return argument.slice(0, argument.length - 1); | ||
function (argument) { | ||
return argument + 'only' | ||
}, | ||
// e.g. 'GPL2' | ||
function(argument) { | ||
return argument.replace(/(\d)$/, '-$1.0'); | ||
function (argument) { | ||
return argument.replace(/(\d)$/, '-$1.0') | ||
}, | ||
// e.g. 'BSD 3' | ||
function(argument) { | ||
return argument.replace(/(-| )?(\d)$/, '-$2-Clause'); | ||
function (argument) { | ||
return argument.replace(/(-| )?(\d)$/, '-$2-Clause') | ||
}, | ||
// e.g. 'BSD clause 3' | ||
function(argument) { | ||
return argument.replace(/(-| )clause(-| )(\d)/, '-$3-Clause'); | ||
function (argument) { | ||
return argument.replace(/(-| )clause(-| )(\d)/, '-$3-Clause') | ||
}, | ||
// e.g. 'BY-NC-4.0' | ||
function(argument) { | ||
return 'CC-' + argument; | ||
function (argument) { | ||
return 'CC-' + argument | ||
}, | ||
// e.g. 'BY-NC' | ||
function(argument) { | ||
return 'CC-' + argument + '-4.0'; | ||
function (argument) { | ||
return 'CC-' + argument + '-4.0' | ||
}, | ||
// e.g. 'Attribution-NonCommercial' | ||
function(argument) { | ||
function (argument) { | ||
return argument | ||
@@ -127,17 +158,50 @@ .replace('Attribution', 'BY') | ||
.replace(/ (\d)/, '-$1') | ||
.replace(/ ?International/, ''); | ||
.replace(/ ?International/, '') | ||
}, | ||
// e.g. 'Attribution-NonCommercial' | ||
function(argument) { | ||
function (argument) { | ||
return 'CC-' + | ||
argument | ||
.replace('Attribution', 'BY') | ||
.replace('NonCommercial', 'NC') | ||
.replace('NoDerivatives', 'ND') | ||
.replace(/ (\d)/, '-$1') | ||
.replace(/ ?International/, '') + | ||
'-4.0'; | ||
.replace('Attribution', 'BY') | ||
.replace('NonCommercial', 'NC') | ||
.replace('NoDerivatives', 'ND') | ||
.replace(/ (\d)/, '-$1') | ||
.replace(/ ?International/, '') + | ||
'-4.0' | ||
} | ||
]; | ||
] | ||
var licensesWithVersions = spdxLicenseIds | ||
.map(function (id) { | ||
var match = /^(.*)-\d+\.\d+$/.exec(id) | ||
return match | ||
? [match[0], match[1]] | ||
: [id, null] | ||
}) | ||
.reduce(function (objectMap, item) { | ||
var key = item[1] | ||
objectMap[key] = objectMap[key] || [] | ||
objectMap[key].push(item[0]) | ||
return objectMap | ||
}, {}) | ||
var licensesWithOneVersion = Object.keys(licensesWithVersions) | ||
.map(function makeEntries (key) { | ||
return [key, licensesWithVersions[key]] | ||
}) | ||
.filter(function identifySoleVersions (item) { | ||
return ( | ||
// Licenses has just one valid version suffix. | ||
item[1].length === 1 && | ||
item[0] !== null && | ||
// APL will be considered Apache, rather than APL-1.0 | ||
item[0] !== 'APL' | ||
) | ||
}) | ||
.map(function createLastResorts (item) { | ||
return [item[0], item[1][0]] | ||
}) | ||
licensesWithVersions = undefined | ||
// If all else fails, guess that strings containing certain substrings | ||
@@ -152,15 +216,19 @@ // meant to identify certain licenses. | ||
['3-CLAUSE', 'BSD-3-Clause'], | ||
['AFFERO', 'AGPL-3.0'], | ||
['AGPL', 'AGPL-3.0'], | ||
['AFFERO', 'AGPL-3.0-or-later'], | ||
['AGPL', 'AGPL-3.0-or-later'], | ||
['APACHE', 'Apache-2.0'], | ||
['ARTISTIC', 'Artistic-2.0'], | ||
['Affero', 'AGPL-3.0'], | ||
['Affero', 'AGPL-3.0-or-later'], | ||
['BEER', 'Beerware'], | ||
['BOOST', 'BSL-1.0'], | ||
['BSD', 'BSD-2-Clause'], | ||
['CDDL', 'CDDL-1.1'], | ||
['ECLIPSE', 'EPL-1.0'], | ||
['FUCK', 'WTFPL'], | ||
['GNU', 'GPL-3.0'], | ||
['LGPL', 'LGPL-3.0'], | ||
['GPL', 'GPL-3.0'], | ||
['GNU', 'GPL-3.0-or-later'], | ||
['LGPL', 'LGPL-3.0-or-later'], | ||
['GPLV1', 'GPL-1.0-only'], | ||
['GPLV2', 'GPL-2.0-only'], | ||
['GPL', 'GPL-3.0-or-later'], | ||
['MIT +NO-FALSE-ATTRIBS', 'MITNFA'], | ||
['MIT', 'MIT'], | ||
@@ -170,32 +238,32 @@ ['MPL', 'MPL-2.0'], | ||
['ZLIB', 'Zlib'] | ||
]; | ||
].concat(licensesWithOneVersion) | ||
var SUBSTRING = 0; | ||
var IDENTIFIER = 1; | ||
var SUBSTRING = 0 | ||
var IDENTIFIER = 1 | ||
var validTransformation = function(identifier) { | ||
var validTransformation = function (identifier) { | ||
for (var i = 0; i < transforms.length; i++) { | ||
var transformed = transforms[i](identifier); | ||
var transformed = transforms[i](identifier).trim() | ||
if (transformed !== identifier && valid(transformed)) { | ||
return transformed; | ||
return transformed | ||
} | ||
} | ||
return null; | ||
}; | ||
return null | ||
} | ||
var validLastResort = function(identifier) { | ||
var upperCased = identifier.toUpperCase(); | ||
var validLastResort = function (identifier) { | ||
var upperCased = identifier.toUpperCase() | ||
for (var i = 0; i < lastResorts.length; i++) { | ||
var lastResort = lastResorts[i]; | ||
var lastResort = lastResorts[i] | ||
if (upperCased.indexOf(lastResort[SUBSTRING]) > -1) { | ||
return lastResort[IDENTIFIER]; | ||
return lastResort[IDENTIFIER] | ||
} | ||
} | ||
return null; | ||
}; | ||
return null | ||
} | ||
var anyCorrection = function(identifier, check) { | ||
var anyCorrection = function (identifier, check) { | ||
for (var i = 0; i < transpositions.length; i++) { | ||
var transposition = transpositions[i]; | ||
var transposed = transposition[TRANSPOSED]; | ||
var transposition = transpositions[i] | ||
var transposed = transposition[TRANSPOSED] | ||
if (identifier.indexOf(transposed) > -1) { | ||
@@ -205,39 +273,60 @@ var corrected = identifier.replace( | ||
transposition[CORRECT] | ||
); | ||
var checked = check(corrected); | ||
) | ||
var checked = check(corrected) | ||
if (checked !== null) { | ||
return checked; | ||
return checked | ||
} | ||
} | ||
} | ||
return null; | ||
}; | ||
return null | ||
} | ||
module.exports = function(identifier) { | ||
identifier = identifier.replace(/\+$/, ''); | ||
module.exports = function (identifier) { | ||
var validArugment = ( | ||
typeof identifier === 'string' && | ||
identifier.trim().length !== 0 | ||
) | ||
if (!validArugment) { | ||
throw Error('Invalid argument. Expected non-empty string.') | ||
} | ||
identifier = identifier.replace(/\+$/, '').trim() | ||
if (valid(identifier)) { | ||
return identifier; | ||
return upgradeGPLs(identifier) | ||
} | ||
var transformed = validTransformation(identifier); | ||
var transformed = validTransformation(identifier) | ||
if (transformed !== null) { | ||
return transformed; | ||
return upgradeGPLs(transformed) | ||
} | ||
transformed = anyCorrection(identifier, function(argument) { | ||
transformed = anyCorrection(identifier, function (argument) { | ||
if (valid(argument)) { | ||
return argument; | ||
return argument | ||
} | ||
return validTransformation(argument); | ||
}); | ||
return validTransformation(argument) | ||
}) | ||
if (transformed !== null) { | ||
return transformed; | ||
return upgradeGPLs(transformed) | ||
} | ||
transformed = validLastResort(identifier); | ||
transformed = validLastResort(identifier) | ||
if (transformed !== null) { | ||
return transformed; | ||
return upgradeGPLs(transformed) | ||
} | ||
transformed = anyCorrection(identifier, validLastResort); | ||
transformed = anyCorrection(identifier, validLastResort) | ||
if (transformed !== null) { | ||
return transformed; | ||
return upgradeGPLs(transformed) | ||
} | ||
return null; | ||
}; | ||
return null | ||
} | ||
function upgradeGPLs (value) { | ||
if ([ | ||
'GPL-1.0', 'LGPL-1.0', 'AGPL-1.0', | ||
'GPL-2.0', 'LGPL-2.0', 'AGPL-2.0', | ||
'LGPL-2.1' | ||
].indexOf(value) !== -1) { | ||
return value + '-only' | ||
} else if (['GPL-3.0', 'LGPL-3.0', 'AGPL-3.0'].indexOf(value) !== -1) { | ||
return value + '-or-later' | ||
} else { | ||
return value | ||
} | ||
} |
{ | ||
"_from": "spdx-correct@~1.0.0", | ||
"_id": "spdx-correct@1.0.2", | ||
"_from": "spdx-correct@^3.0.0", | ||
"_id": "spdx-correct@3.0.0", | ||
"_inBundle": false, | ||
"_integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", | ||
"_integrity": "sha512-N19o9z5cEyc8yQQPukRCZ9EUmb4HUpnrmaL/fxS2pBo2jbfcFRVuFZ/oFC+vZz0MNNk0h80iMn5/S6qGZOL5+g==", | ||
"_location": "/spdx-correct", | ||
@@ -11,8 +11,8 @@ "_phantomChildren": {}, | ||
"registry": true, | ||
"raw": "spdx-correct@~1.0.0", | ||
"raw": "spdx-correct@^3.0.0", | ||
"name": "spdx-correct", | ||
"escapedName": "spdx-correct", | ||
"rawSpec": "~1.0.0", | ||
"rawSpec": "^3.0.0", | ||
"saveSpec": null, | ||
"fetchSpec": "~1.0.0" | ||
"fetchSpec": "^3.0.0" | ||
}, | ||
@@ -22,5 +22,5 @@ "_requiredBy": [ | ||
], | ||
"_resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", | ||
"_shasum": "4b3073d933ff51f3912f03ac5519498a4150db40", | ||
"_spec": "spdx-correct@~1.0.0", | ||
"_resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.0.tgz", | ||
"_shasum": "05a5b4d7153a195bc92c3c425b69f3b2a9524c82", | ||
"_spec": "spdx-correct@^3.0.0", | ||
"_where": "/Users/benjamincoe/bcoe/nyc/node_modules/validate-npm-package-license", | ||
@@ -33,17 +33,33 @@ "author": { | ||
"bugs": { | ||
"url": "https://github.com/kemitchell/spdx-correct.js/issues" | ||
"url": "https://github.com/jslicense/spdx-correct.js/issues" | ||
}, | ||
"bundleDependencies": false, | ||
"contributors": [ | ||
{ | ||
"name": "Kyle E. Mitchell", | ||
"email": "kyle@kemitchell.com", | ||
"url": "https://kemitchell.com" | ||
}, | ||
{ | ||
"name": "Christian Zommerfelds", | ||
"email": "aero_super@yahoo.com" | ||
} | ||
], | ||
"dependencies": { | ||
"spdx-license-ids": "^1.0.2" | ||
"spdx-expression-parse": "^3.0.0", | ||
"spdx-license-ids": "^3.0.0" | ||
}, | ||
"deprecated": false, | ||
"description": "correct invalid SPDX identifiers", | ||
"description": "correct invalid SPDX expressions", | ||
"devDependencies": { | ||
"defence-cli": "^1.0.1", | ||
"defence-cli": "^2.0.1", | ||
"replace-require-self": "^1.0.0", | ||
"spdx-expression-parse": "^1.0.0", | ||
"tape": "~4.0.0" | ||
"standard": "^11.0.0", | ||
"standard-markdown": "^4.0.2", | ||
"tape": "^4.9.0" | ||
}, | ||
"homepage": "https://github.com/kemitchell/spdx-correct.js#readme", | ||
"files": [ | ||
"index.js" | ||
], | ||
"homepage": "https://github.com/jslicense/spdx-correct.js#readme", | ||
"keywords": [ | ||
@@ -60,8 +76,9 @@ "SPDX", | ||
"type": "git", | ||
"url": "git+https://github.com/kemitchell/spdx-correct.js.git" | ||
"url": "git+https://github.com/jslicense/spdx-correct.js.git" | ||
}, | ||
"scripts": { | ||
"test": "defence README.md | replace-require-self | node && tape *.test.js" | ||
"lint": "standard && standard-markdown", | ||
"test": "defence README.md | replace-require-self | node && node test.js" | ||
}, | ||
"version": "1.0.2" | ||
"version": "3.0.0" | ||
} |
```javascript | ||
var correct = require('spdx-correct'); | ||
var assert = require('assert'); | ||
var correct = require('spdx-correct') | ||
var assert = require('assert') | ||
@@ -5,0 +5,0 @@ assert.equal(correct('mit'), 'MIT') |
@@ -1,5 +0,8 @@ | ||
var parser = require('./parser').parser | ||
'use strict' | ||
module.exports = function (argument) { | ||
return parser.parse(argument) | ||
var scan = require('./scan') | ||
var parse = require('./parse') | ||
module.exports = function (source) { | ||
return parse(scan(source)) | ||
} |
{ | ||
"_from": "spdx-expression-parse@~1.0.0", | ||
"_id": "spdx-expression-parse@1.0.4", | ||
"_from": "spdx-expression-parse@^3.0.0", | ||
"_id": "spdx-expression-parse@3.0.0", | ||
"_inBundle": false, | ||
"_integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=", | ||
"_integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", | ||
"_location": "/spdx-expression-parse", | ||
@@ -11,15 +11,16 @@ "_phantomChildren": {}, | ||
"registry": true, | ||
"raw": "spdx-expression-parse@~1.0.0", | ||
"raw": "spdx-expression-parse@^3.0.0", | ||
"name": "spdx-expression-parse", | ||
"escapedName": "spdx-expression-parse", | ||
"rawSpec": "~1.0.0", | ||
"rawSpec": "^3.0.0", | ||
"saveSpec": null, | ||
"fetchSpec": "~1.0.0" | ||
"fetchSpec": "^3.0.0" | ||
}, | ||
"_requiredBy": [ | ||
"/spdx-correct", | ||
"/validate-npm-package-license" | ||
], | ||
"_resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", | ||
"_shasum": "9bdf2f20e1f40ed447fbe273266191fced51626c", | ||
"_spec": "spdx-expression-parse@~1.0.0", | ||
"_resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", | ||
"_shasum": "99e119b7a5da00e05491c9fa338b7904823b41d0", | ||
"_spec": "spdx-expression-parse@^3.0.0", | ||
"_where": "/Users/benjamincoe/bcoe/nyc/node_modules/validate-npm-package-license", | ||
@@ -32,3 +33,3 @@ "author": { | ||
"bugs": { | ||
"url": "https://github.com/kemitchell/spdx-expression-parse.js/issues" | ||
"url": "https://github.com/jslicense/spdx-expression-parse.js/issues" | ||
}, | ||
@@ -50,13 +51,19 @@ "bundleDependencies": false, | ||
"email": "snnskwtnb@gmail.com" | ||
}, | ||
{ | ||
"name": "Antoine Motet", | ||
"email": "antoine.motet@gmail.com" | ||
} | ||
], | ||
"dependencies": { | ||
"spdx-exceptions": "^2.1.0", | ||
"spdx-license-ids": "^3.0.0" | ||
}, | ||
"deprecated": false, | ||
"description": "parse SPDX license expressions", | ||
"devDependencies": { | ||
"defence-cli": "^1.0.1", | ||
"jison": "^0.4.15", | ||
"defence-cli": "^2.0.1", | ||
"mocha": "^3.4.2", | ||
"replace-require-self": "^1.0.0", | ||
"spdx-exceptions": "^1.0.4", | ||
"spdx-license-ids": "^1.0.0", | ||
"standard": "^8.0.0" | ||
"standard": "^10.0.2" | ||
}, | ||
@@ -66,5 +73,6 @@ "files": [ | ||
"index.js", | ||
"parser.js" | ||
"parse.js", | ||
"scan.js" | ||
], | ||
"homepage": "https://github.com/kemitchell/spdx-expression-parse.js#readme", | ||
"homepage": "https://github.com/jslicense/spdx-expression-parse.js#readme", | ||
"keywords": [ | ||
@@ -80,15 +88,15 @@ "SPDX", | ||
], | ||
"license": "(MIT AND CC-BY-3.0)", | ||
"license": "MIT", | ||
"name": "spdx-expression-parse", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/kemitchell/spdx-expression-parse.js.git" | ||
"url": "git+https://github.com/jslicense/spdx-expression-parse.js.git" | ||
}, | ||
"scripts": { | ||
"lint": "standard", | ||
"prepublish": "node generate-parser.js > parser.js", | ||
"pretest": "npm run prepublish", | ||
"test": "defence -i javascript README.md | replace-require-self | node" | ||
"test": "npm run test:mocha && npm run test:readme", | ||
"test:mocha": "mocha test/index.js", | ||
"test:readme": "defence -i javascript README.md | replace-require-self | node" | ||
}, | ||
"version": "1.0.4" | ||
"version": "3.0.0" | ||
} |
@@ -1,2 +0,2 @@ | ||
This package parses SPDX license expression strings describing license terms, like [package.json license strings](https://docs.npmjs.com/files/package.json#license), into consistently structured ECMAScript objects. The npm command-line interface depends on this package, as do many automatic license-audit tools. | ||
This package parses [SPDX license expression](https://spdx.org/spdx-specification-21-web-version#h.jxpfx0ykyb60) strings describing license terms, like [package.json license strings](https://docs.npmjs.com/files/package.json#license), into consistently structured ECMAScript objects. The npm command-line interface depends on this package, as do many automatic license-audit tools. | ||
@@ -22,4 +22,5 @@ In a nutshell: | ||
assert.deepEqual( | ||
// Dual licensed under LGPL 2.1 or a combination of the Three-Clause | ||
// BSD License and the MIT License. | ||
// Dual licensed under either: | ||
// - LGPL 2.1 | ||
// - a combination of Three-Clause BSD and MIT | ||
parse('(LGPL-2.1 OR BSD-3-Clause AND MIT)'), | ||
@@ -42,3 +43,3 @@ { | ||
1. The [license list](https://spdx.org/licenses), a mapping from specific string identifiers, like `Apache-2.0`, to standard form license texts and bolt-on license exceptions. The [spdx-license-ids](https://www.npmjs.com/package/spdx-exceptions) and [spdx-exceptions](https://www.npmjs.com/package/spdx-license-ids) packages implement the license list. They are development dependencies of this package. | ||
1. The [license list](https://spdx.org/licenses), a mapping from specific string identifiers, like `Apache-2.0`, to standard form license texts and bolt-on license exceptions. The [spdx-license-ids](https://www.npmjs.com/package/spdx-exceptions) and [spdx-exceptions](https://www.npmjs.com/package/spdx-license-ids) packages implement the license list. `spdx-expression-parse` depends on and `require()`s them. | ||
@@ -48,3 +49,7 @@ Any license identifier from the license list is a valid license expression: | ||
```javascript | ||
require('spdx-license-ids').forEach(function (id) { | ||
var identifiers = [] | ||
.concat(require('spdx-license-ids')) | ||
.concat(require('spdx-license-ids/deprecated')) | ||
identifiers.forEach(function (id) { | ||
assert.deepEqual(parse(id), {license: id}) | ||
@@ -57,3 +62,3 @@ }) | ||
```javascript | ||
require('spdx-license-ids').forEach(function (id) { | ||
identifiers.forEach(function (id) { | ||
require('spdx-exceptions').forEach(function (e) { | ||
@@ -68,8 +73,11 @@ assert.deepEqual( | ||
2. The license expression language, for describing simple and complex license terms, like `MIT` for MIT-licensed and `(GPL-2.0 OR Apache-2.0)` for dual-licensing under GPL 2.0 and Apache 2.0. This package implements the license expression language. | ||
2. The license expression language, for describing simple and complex license terms, like `MIT` for MIT-licensed and `(GPL-2.0 OR Apache-2.0)` for dual-licensing under GPL 2.0 and Apache 2.0. `spdx-expression-parse` itself implements license expression language, exporting a parser. | ||
```javascript | ||
assert.deepEqual( | ||
// Licensed under a combination of the MIT License and a combination | ||
// of LGPL 2.1 (or a later version) and the Three-Clause BSD License. | ||
// Licensed under a combination of: | ||
// - the MIT License AND | ||
// - a combination of: | ||
// - LGPL 2.1 (or a later version) AND | ||
// - Three-Clause BSD | ||
parse('(MIT AND (LGPL-2.1+ AND BSD-3-Clause))'), | ||
@@ -76,0 +84,0 @@ { |
{ | ||
"_from": "spdx-license-ids@^1.0.2", | ||
"_id": "spdx-license-ids@1.2.2", | ||
"_from": "spdx-license-ids@^3.0.0", | ||
"_id": "spdx-license-ids@3.0.0", | ||
"_inBundle": false, | ||
"_integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", | ||
"_integrity": "sha512-2+EPwgbnmOIl8HjGBXXMd9NAu02vLjOO1nWw4kmeRDFyHn+M/ETfHxQUK0oXg8ctgVnl9t3rosNVsZ1jG61nDA==", | ||
"_location": "/spdx-license-ids", | ||
@@ -11,15 +11,16 @@ "_phantomChildren": {}, | ||
"registry": true, | ||
"raw": "spdx-license-ids@^1.0.2", | ||
"raw": "spdx-license-ids@^3.0.0", | ||
"name": "spdx-license-ids", | ||
"escapedName": "spdx-license-ids", | ||
"rawSpec": "^1.0.2", | ||
"rawSpec": "^3.0.0", | ||
"saveSpec": null, | ||
"fetchSpec": "^1.0.2" | ||
"fetchSpec": "^3.0.0" | ||
}, | ||
"_requiredBy": [ | ||
"/spdx-correct" | ||
"/spdx-correct", | ||
"/spdx-expression-parse" | ||
], | ||
"_resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", | ||
"_shasum": "c9df7a3424594ade6bd11900d596696dc06bac57", | ||
"_spec": "spdx-license-ids@^1.0.2", | ||
"_resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz", | ||
"_shasum": "7a7cd28470cc6d3a1cfe6d66886f6bc430d3ac87", | ||
"_spec": "spdx-license-ids@^3.0.0", | ||
"_where": "/Users/benjamincoe/bcoe/nyc/node_modules/spdx-correct", | ||
@@ -37,16 +38,18 @@ "author": { | ||
"devDependencies": { | ||
"@shinnn/eslint-config-node": "^3.0.0", | ||
"chalk": "^1.1.3", | ||
"eslint": "^3.1.1", | ||
"get-spdx-license-ids": "^1.0.0", | ||
"istanbul": "^0.4.4", | ||
"@shinnn/eslint-config-node": "^5.0.0", | ||
"chalk": "^2.3.0", | ||
"eslint": "^4.16.0", | ||
"get-spdx-license-ids": "^2.1.0", | ||
"log-symbols": "^2.2.0", | ||
"loud-rejection": "^1.6.0", | ||
"rimraf-promise": "^2.0.0", | ||
"stringify-object": "^2.4.0", | ||
"tap-spec": "^4.1.1", | ||
"tape": "^4.6.0", | ||
"write-file-atomically": "1.0.0" | ||
"rmfr": "^2.0.0-3", | ||
"tape": "^4.8.0", | ||
"write-file-atomically": "^1.0.0" | ||
}, | ||
"eslintConfig": { | ||
"extends": "@shinnn/node" | ||
}, | ||
"files": [ | ||
"spdx-license-ids.json" | ||
"deprecated.json", | ||
"index.json" | ||
], | ||
@@ -63,8 +66,5 @@ "homepage": "https://github.com/shinnn/spdx-license-ids#readme", | ||
"array", | ||
"oss", | ||
"browser", | ||
"client-side" | ||
"oss" | ||
], | ||
"license": "Unlicense", | ||
"main": "spdx-license-ids.json", | ||
"license": "CC0-1.0", | ||
"name": "spdx-license-ids", | ||
@@ -76,9 +76,7 @@ "repository": { | ||
"scripts": { | ||
"build": "node --strong_mode build.js", | ||
"coverage": "node --strong_mode node_modules/.bin/istanbul cover test.js", | ||
"lint": "eslint --config @shinnn/node --env browser --ignore-path .gitignore .", | ||
"pretest": "${npm_package_scripts_build} && ${npm_package_scripts_lint}", | ||
"test": "node --strong_mode test.js | tap-spec" | ||
"build": "node build.js", | ||
"pretest": "eslint --fix --format=codeframe .", | ||
"test": "node test.js" | ||
}, | ||
"version": "1.2.2" | ||
"version": "3.0.0" | ||
} |
# spdx-license-ids | ||
A list of [SPDX license](https://spdx.org/licenses/) identifiers | ||
[**Download JSON**](https://raw.githubusercontent.com/shinnn/spdx-license-ids/master/spdx-license-ids.json) | ||
## Use as a JavaScript Library | ||
[![NPM version](https://img.shields.io/npm/v/spdx-license-ids.svg)](https://www.npmjs.org/package/spdx-license-ids) | ||
[![Bower version](https://img.shields.io/bower/v/spdx-license-ids.svg)](https://github.com/shinnn/spdx-license-ids/releases) | ||
[![npm version](https://img.shields.io/npm/v/spdx-license-ids.svg)](https://www.npmjs.org/package/spdx-license-ids) | ||
[![Build Status](https://travis-ci.org/shinnn/spdx-license-ids.svg?branch=master)](https://travis-ci.org/shinnn/spdx-license-ids) | ||
[![Coverage Status](https://img.shields.io/coveralls/shinnn/spdx-license-ids.svg)](https://coveralls.io/r/shinnn/spdx-license-ids) | ||
[![devDependency Status](https://david-dm.org/shinnn/spdx-license-ids/dev-status.svg)](https://david-dm.org/shinnn/spdx-license-ids#info=devDependencies) | ||
### Installation | ||
A list of [SPDX license](https://spdx.org/licenses/) identifiers | ||
#### Package managers | ||
## Installation | ||
##### [npm](https://www.npmjs.com/) | ||
[Download JSON directly](https://raw.githubusercontent.com/shinnn/spdx-license-ids/master/index.json), or [use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/getting-started/what-is-npm): | ||
```sh | ||
``` | ||
npm install spdx-license-ids | ||
``` | ||
##### [bower](http://bower.io/) | ||
## [Node.js](https://nodejs.org/) API | ||
```sh | ||
bower install spdx-license-ids | ||
``` | ||
### require('spdx-license-ids') | ||
##### [Duo](http://duojs.org/) | ||
Type: `<Array<string>>` | ||
All license IDs except for the currently deprecated ones. | ||
```javascript | ||
const spdxLicenseIds = require('shinnn/spdx-license-ids'); | ||
const ids = require('spdx-license-ids'); | ||
//=> ['0BSD', 'AAL', 'Abstyles', 'Adobe-2006', 'Adobe-Glyph', 'ADSL', 'AFL-1.1', ...] | ||
ids.includes('BSD-3-Clause'); //=> true | ||
ids.includes('CC-BY-1.0'); //=> true | ||
ids.includes('GPL-3.0'); //=> false | ||
``` | ||
#### Standalone | ||
### require('spdx-license-ids/deprecated') | ||
[Download the script file directly.](https://raw.githubusercontent.com/shinnn/spdx-license-ids/master/spdx-license-ids-browser.js) | ||
Type: `<Array<string>>` | ||
### API | ||
Deprecated license IDs. | ||
#### spdxLicenseIds | ||
```javascript | ||
const deprecatedIds = require('spdx-license-ids/deprecated'); | ||
//=> ['AGPL-3.0', 'eCos-2.0', 'GFDL-1.1', 'GFDL-1.2', 'GFDL-1.3', 'GPL-1.0', ...] | ||
Type: `Array` of `String` | ||
deprecatedIds.includes('BSD-3-Clause'); //=> false | ||
deprecatedIds.includes('CC-BY-1.0'); //=> false | ||
It returns an array of SPDX license identifiers. | ||
```javascript | ||
const spdxLicenseIds = require('spdx-license-ids'); //=> ['Glide', 'Abstyles', 'AFL-1.1', ... ] | ||
deprecatedIds.includes('GPL-3.0'); //=> true | ||
``` | ||
@@ -55,2 +52,2 @@ | ||
[The Unlicense](./LICENSE). | ||
[Creative Commons Zero v1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/deed) |
@@ -19,4 +19,2 @@ { | ||
"_requiredBy": [ | ||
"/standard-version/yargs", | ||
"/table", | ||
"/yargs", | ||
@@ -23,0 +21,0 @@ "/yargs/cliui" |
@@ -20,7 +20,2 @@ { | ||
"/chalk", | ||
"/inquirer", | ||
"/inquirer/string-width", | ||
"/standard-version/cliui", | ||
"/standard-version/cliui/string-width", | ||
"/unicode-length", | ||
"/wrap-ansi", | ||
@@ -27,0 +22,0 @@ "/wrap-ansi/string-width" |
@@ -6,2 +6,13 @@ # Change Log | ||
<a name="4.2.1"></a> | ||
## [4.2.1](https://github.com/istanbuljs/istanbuljs/compare/test-exclude@4.2.0...test-exclude@4.2.1) (2018-03-04) | ||
### Bug Fixes | ||
* upgrade micromatch ([#142](https://github.com/istanbuljs/istanbuljs/issues/142)) ([24104a7](https://github.com/istanbuljs/istanbuljs/commit/24104a7)) | ||
<a name="4.2.0"></a> | ||
@@ -8,0 +19,0 @@ # [4.2.0](https://github.com/istanbuljs/istanbuljs/compare/test-exclude@4.1.1...test-exclude@4.2.0) (2018-02-13) |
@@ -88,5 +88,5 @@ const assign = require('object-assign') | ||
!this.include || | ||
micromatch.any(pathToCheck, this.include, {dotfiles: true})) && | ||
(!micromatch.any(pathToCheck, this.exclude, {dotfiles: true}) || | ||
micromatch.any(pathToCheck, this.excludeNegated, {dotfiles: true})) | ||
micromatch.any(pathToCheck, this.include, {dot: true})) && | ||
(!micromatch.any(pathToCheck, this.exclude, {dot: true}) || | ||
micromatch.any(pathToCheck, this.excludeNegated, {dot: true})) | ||
} | ||
@@ -93,0 +93,0 @@ |
{ | ||
"_from": "test-exclude@^4.2.0", | ||
"_id": "test-exclude@4.2.0", | ||
"_id": "test-exclude@4.2.1", | ||
"_inBundle": false, | ||
"_integrity": "sha512-8hMFzjxbPv6xSlwGhXSvOMJ/vTy3bkng+2pxmf6E1z6VF7I9nIyNfvHtaw+NBPgvz647gADBbMSbwLfZYppT/w==", | ||
"_integrity": "sha512-qpqlP/8Zl+sosLxBcVKl9vYy26T9NPalxSzzCP/OY6K7j938ui2oKgo+kRZYfxAeIpLqpbVnsHq1tyV70E4lWQ==", | ||
"_location": "/test-exclude", | ||
"_phantomChildren": {}, | ||
"_phantomChildren": { | ||
"arr-flatten": "1.1.0", | ||
"debug": "2.6.9", | ||
"define-property": "2.0.2", | ||
"extend-shallow": "3.0.2", | ||
"fragment-cache": "0.2.1", | ||
"is-buffer": "1.1.6", | ||
"is-descriptor": "1.0.2", | ||
"is-extendable": "0.1.1", | ||
"nanomatch": "1.2.9", | ||
"object.pick": "1.3.0", | ||
"posix-character-classes": "0.1.1", | ||
"regex-not": "1.0.2", | ||
"repeat-element": "1.1.2", | ||
"repeat-string": "1.6.1", | ||
"snapdragon": "0.8.2", | ||
"snapdragon-node": "2.1.1", | ||
"split-string": "3.1.0", | ||
"to-regex": "3.0.2", | ||
"to-regex-range": "2.1.1" | ||
}, | ||
"_requested": { | ||
@@ -21,4 +41,4 @@ "type": "range", | ||
], | ||
"_resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-4.2.0.tgz", | ||
"_shasum": "07e3613609a362c74516a717515e13322ab45b3c", | ||
"_resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-4.2.1.tgz", | ||
"_shasum": "dfa222f03480bca69207ca728b37d74b45f724fa", | ||
"_spec": "test-exclude@^4.2.0", | ||
@@ -36,3 +56,3 @@ "_where": "/Users/benjamincoe/bcoe/nyc", | ||
"arrify": "^1.0.1", | ||
"micromatch": "^2.3.11", | ||
"micromatch": "^3.1.8", | ||
"object-assign": "^4.1.0", | ||
@@ -76,3 +96,3 @@ "read-pkg-up": "^1.0.1", | ||
}, | ||
"version": "4.2.0" | ||
"version": "4.2.1" | ||
} |
{ | ||
"_from": "validate-npm-package-license@^3.0.1", | ||
"_id": "validate-npm-package-license@3.0.1", | ||
"_id": "validate-npm-package-license@3.0.3", | ||
"_inBundle": false, | ||
"_integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", | ||
"_integrity": "sha512-63ZOUnL4SIXj4L0NixR3L1lcjO38crAbgrTpl28t8jjrfuiOBL5Iygm+60qPs/KsZGzPNg6Smnc/oY16QTjF0g==", | ||
"_location": "/validate-npm-package-license", | ||
@@ -21,4 +21,4 @@ "_phantomChildren": {}, | ||
], | ||
"_resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", | ||
"_shasum": "2804babe712ad3379459acfbe24746ab2c303fbc", | ||
"_resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.3.tgz", | ||
"_shasum": "81643bcbef1bdfecd4623793dc4648948ba98338", | ||
"_spec": "validate-npm-package-license@^3.0.1", | ||
@@ -36,4 +36,4 @@ "_where": "/Users/benjamincoe/bcoe/nyc/node_modules/normalize-package-data", | ||
"dependencies": { | ||
"spdx-correct": "~1.0.0", | ||
"spdx-expression-parse": "~1.0.0" | ||
"spdx-correct": "^3.0.0", | ||
"spdx-expression-parse": "^3.0.0" | ||
}, | ||
@@ -43,3 +43,3 @@ "deprecated": false, | ||
"devDependencies": { | ||
"defence-cli": "^1.0.1", | ||
"defence-cli": "^2.0.1", | ||
"replace-require-self": "^1.0.0" | ||
@@ -63,3 +63,3 @@ }, | ||
}, | ||
"version": "3.0.1" | ||
"version": "3.0.3" | ||
} |
@@ -50,3 +50,3 @@ validate-npm-package-license | ||
assert.deepEqual( | ||
valid('(GPL-3.0 OR BSD-2-Clause)'), | ||
valid('(GPL-3.0-only OR BSD-2-Clause)'), | ||
validSPDXExpression | ||
@@ -53,0 +53,0 @@ ); |
@@ -19,3 +19,2 @@ { | ||
"_requiredBy": [ | ||
"/standard-version/yargs", | ||
"/yargs" | ||
@@ -22,0 +21,0 @@ ], |
@@ -23,3 +23,2 @@ { | ||
"_requiredBy": [ | ||
"/standard-version/cliui", | ||
"/yargs/cliui" | ||
@@ -26,0 +25,0 @@ ], |
@@ -19,3 +19,2 @@ { | ||
"_requiredBy": [ | ||
"/standard-version/yargs", | ||
"/yargs" | ||
@@ -22,0 +21,0 @@ ], |
@@ -19,4 +19,3 @@ { | ||
"_requiredBy": [ | ||
"/", | ||
"/yargs" | ||
"/" | ||
], | ||
@@ -23,0 +22,0 @@ "_resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-8.1.0.tgz", |
@@ -9,5 +9,5 @@ | ||
function checkForCircularExtends (path) { | ||
if (previouslyVisitedConfigs.indexOf(path) > -1) { | ||
throw new YError(`Circular extended configurations: '${path}'.`) | ||
function checkForCircularExtends (cfgPath) { | ||
if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) { | ||
throw new YError(`Circular extended configurations: '${cfgPath}'.`) | ||
} | ||
@@ -25,3 +25,3 @@ } | ||
if (typeof config.extends !== 'string') return defaultConfig | ||
const isPath = /\.json$/.test(config.extends) | ||
const isPath = /\.json|\..*rc$/.test(config.extends) | ||
let pathToDefault = null | ||
@@ -28,0 +28,0 @@ if (!isPath) { |
@@ -155,13 +155,20 @@ 'use strict' | ||
const options = yargs.getOptions() | ||
let keys = Object.keys( | ||
Object.keys(descriptions) | ||
.concat(Object.keys(demandedOptions)) | ||
.concat(Object.keys(demandedCommands)) | ||
.concat(Object.keys(options.default)) | ||
.reduce((acc, key) => { | ||
if (key !== '_') acc[key] = true | ||
return acc | ||
}, {}) | ||
) | ||
let keys = [] | ||
keys = keys.concat(Object.keys(descriptions)) | ||
keys = keys.concat(Object.keys(demandedOptions)) | ||
keys = keys.concat(Object.keys(demandedCommands)) | ||
keys = keys.concat(Object.keys(options.default)) | ||
keys = keys.filter(key => { | ||
if (options.hiddenOptions.indexOf(key) < 0) { | ||
return true | ||
} else if (yargs.parsed.argv[options.showHiddenOpt]) { | ||
return true | ||
} | ||
}) | ||
keys = Object.keys(keys.reduce((acc, key) => { | ||
if (key !== '_') acc[key] = true | ||
return acc | ||
}, {})) | ||
const theWrap = getWrap() | ||
@@ -168,0 +175,0 @@ const ui = require('cliui')({ |
@@ -57,36 +57,2 @@ 'use strict' | ||
// make sure that any args that require an | ||
// value (--foo=bar), have a value. | ||
self.missingArgumentValue = function missingArgumentValue (argv) { | ||
const defaultValues = [true, false, '', undefined] | ||
const options = yargs.getOptions() | ||
if (options.requiresArg.length > 0) { | ||
const missingRequiredArgs = [] | ||
options.requiresArg.forEach((key) => { | ||
// if the argument is not set in argv no need to check | ||
// whether a right-hand-side has been provided. | ||
if (!argv.hasOwnProperty(key)) return | ||
const value = argv[key] | ||
// if a value is explicitly requested, | ||
// flag argument as missing if it does not | ||
// look like foo=bar was entered. | ||
if (~defaultValues.indexOf(value) || | ||
(Array.isArray(value) && !value.length)) { | ||
missingRequiredArgs.push(key) | ||
} | ||
}) | ||
if (missingRequiredArgs.length > 0) { | ||
usage.fail(__n( | ||
'Missing argument value: %s', | ||
'Missing argument values: %s', | ||
missingRequiredArgs.length, | ||
missingRequiredArgs.join(', ') | ||
)) | ||
} | ||
} | ||
} | ||
// make sure all the required arguments are present. | ||
@@ -93,0 +59,0 @@ self.requiredArguments = function requiredArguments (argv) { |
{ | ||
"_from": "yargs@^10.0.3", | ||
"_id": "yargs@10.1.2", | ||
"_from": "yargs@11.1.0", | ||
"_id": "yargs@11.1.0", | ||
"_inBundle": false, | ||
"_integrity": "sha512-ivSoxqBGYOqQVruxD35+EyCFDYNEFL/Uo6FcOnz+9xZdZzK0Zzw4r4KhbrME1Oo2gOggwJod2MnsdamSG7H9ig==", | ||
"_integrity": "sha512-NwW69J42EsCSanF8kyn5upxvjp5ds+t3+udGBeTbFnERA+lF541DDpMawzo4z6W/QrzNM18D+BPMiOBibnFV5A==", | ||
"_location": "/yargs", | ||
@@ -12,10 +12,10 @@ "_phantomChildren": { | ||
"_requested": { | ||
"type": "range", | ||
"type": "version", | ||
"registry": true, | ||
"raw": "yargs@^10.0.3", | ||
"raw": "yargs@11.1.0", | ||
"name": "yargs", | ||
"escapedName": "yargs", | ||
"rawSpec": "^10.0.3", | ||
"rawSpec": "11.1.0", | ||
"saveSpec": null, | ||
"fetchSpec": "^10.0.3" | ||
"fetchSpec": "11.1.0" | ||
}, | ||
@@ -25,5 +25,5 @@ "_requiredBy": [ | ||
], | ||
"_resolved": "https://registry.npmjs.org/yargs/-/yargs-10.1.2.tgz", | ||
"_shasum": "454d074c2b16a51a43e2fb7807e4f9de69ccb5c5", | ||
"_spec": "yargs@^10.0.3", | ||
"_resolved": "https://registry.npmjs.org/yargs/-/yargs-11.1.0.tgz", | ||
"_shasum": "90b869934ed6e871115ea2ff58b03f4724ed2d77", | ||
"_spec": "yargs@11.1.0", | ||
"_where": "/Users/benjamincoe/bcoe/nyc", | ||
@@ -46,3 +46,3 @@ "bugs": { | ||
"y18n": "^3.2.1", | ||
"yargs-parser": "^8.1.0" | ||
"yargs-parser": "^9.0.2" | ||
}, | ||
@@ -56,3 +56,3 @@ "deprecated": false, | ||
"cpr": "^2.0.0", | ||
"cross-spawn": "^5.0.1", | ||
"cross-spawn": "^6.0.4", | ||
"es6-promise": "^4.0.2", | ||
@@ -107,3 +107,3 @@ "hashish": "0.0.4", | ||
}, | ||
"version": "10.1.2" | ||
"version": "11.1.0" | ||
} |
@@ -1,2 +0,9 @@ | ||
# Yargs | ||
<p align="center"> | ||
<img width="250" src="/yargs-logo.png"> | ||
</p> | ||
<h1 align="center"> Yargs </h1> | ||
<p align="center"> | ||
<b >Yargs be a node.js library fer hearties tryin' ter parse optstrings</b> | ||
</p> | ||
<br> | ||
@@ -11,10 +18,7 @@ [![Build Status][travis-image]][travis-url] | ||
_Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com)_. | ||
## Description : | ||
Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface. | ||
> Yargs be a node.js library fer hearties tryin' ter parse optstrings. | ||
It gives you: | ||
<img width="250" src="/yargs-logo.png"> | ||
Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface. It gives you: | ||
* commands and (grouped) options (`my-program.js serve --port=5000`). | ||
@@ -34,4 +38,6 @@ * a dynamically generated help menu based on your arguments. | ||
## Simple Example | ||
## Usage : | ||
### Simple Example | ||
````javascript | ||
@@ -56,5 +62,5 @@ #!/usr/bin/env node | ||
## Complex Example | ||
### Complex Example | ||
```js | ||
```javascript | ||
#!/usr/bin/env node | ||
@@ -81,4 +87,10 @@ require('yargs') // eslint-disable-line | ||
## Table of Contents | ||
## Community : | ||
Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com). | ||
## Documentation : | ||
### Table of Contents | ||
* [Yargs' API](/docs/api.md) | ||
@@ -85,0 +97,0 @@ * [Examples](/docs/examples.md) |
@@ -95,4 +95,5 @@ 'use strict' | ||
const arrayOptions = [ | ||
'array', 'boolean', 'string', 'requiresArg', 'skipValidation', | ||
'count', 'normalize', 'number' | ||
'array', 'boolean', 'string', 'skipValidation', | ||
'count', 'normalize', 'number', | ||
'hiddenOptions' | ||
] | ||
@@ -208,3 +209,3 @@ | ||
argsert('<array|string>', [keys], arguments.length) | ||
populateParserHintArray('requiresArg', keys) | ||
populateParserHintObject(self.nargs, false, 'narg', keys, 1) | ||
return self | ||
@@ -481,4 +482,4 @@ } | ||
self.pkgConf = function pkgConf (key, path) { | ||
argsert('<string> [string]', [key, path], arguments.length) | ||
self.pkgConf = function pkgConf (key, rootPath) { | ||
argsert('<string> [string]', [key, rootPath], arguments.length) | ||
let conf = null | ||
@@ -488,7 +489,7 @@ // prefer cwd to require-main-filename in this method | ||
// rather than "yargs" config in nyc (where nyc is the main filename) | ||
const obj = pkgUp(path || cwd) | ||
const obj = pkgUp(rootPath || cwd) | ||
// If an object exists in the key, add it to options.configObjects | ||
if (obj[key] && typeof obj[key] === 'object') { | ||
conf = applyExtends(obj[key], path || cwd) | ||
conf = applyExtends(obj[key], rootPath || cwd) | ||
options.configObjects = (options.configObjects || []).concat(conf) | ||
@@ -501,4 +502,4 @@ } | ||
const pkgs = {} | ||
function pkgUp (path) { | ||
const npath = path || '*' | ||
function pkgUp (rootPath) { | ||
const npath = rootPath || '*' | ||
if (pkgs[npath]) return pkgs[npath] | ||
@@ -509,5 +510,13 @@ const findUp = require('find-up') | ||
try { | ||
let startDir = rootPath || require('require-main-filename')(parentRequire || require) | ||
// When called in an environment that lacks require.main.filename, such as a jest test runner, | ||
// startDir is already process.cwd(), and should not be shortened. | ||
// Whether or not it is _actually_ a directory (e.g., extensionless bin) is irrelevant, find-up handles it. | ||
if (!rootPath && path.extname(startDir)) { | ||
startDir = path.dirname(startDir) | ||
} | ||
const pkgJsonPath = findUp.sync('package.json', { | ||
cwd: path || require('path').dirname(require('require-main-filename')(parentRequire || require)), | ||
normalize: false | ||
cwd: startDir | ||
}) | ||
@@ -658,4 +667,5 @@ obj = JSON.parse(fs.readFileSync(pkgJsonPath)) | ||
const desc = opt.describe || opt.description || opt.desc | ||
if (!opt.hidden) { | ||
self.describe(key, desc) | ||
self.describe(key, desc) | ||
if (opt.hidden) { | ||
self.hide(key) | ||
} | ||
@@ -826,2 +836,24 @@ | ||
const defaultShowHiddenOpt = 'show-hidden' | ||
options.showHiddenOpt = defaultShowHiddenOpt | ||
self.addShowHiddenOpt = self.showHidden = function addShowHiddenOpt (opt, msg) { | ||
argsert('[string|boolean] [string]', [opt, msg], arguments.length) | ||
if (arguments.length === 1) { | ||
if (opt === false) return self | ||
} | ||
const showHiddenOpt = typeof opt === 'string' ? opt : defaultShowHiddenOpt | ||
self.boolean(showHiddenOpt) | ||
self.describe(showHiddenOpt, msg || usage.deferY18nLookup('Show hidden options')) | ||
options.showHiddenOpt = showHiddenOpt | ||
return self | ||
} | ||
self.hide = function hide (key) { | ||
argsert('<string|object>', [key], arguments.length) | ||
options.hiddenOptions.push(key) | ||
return self | ||
} | ||
self.showHelpOnFail = function showHelpOnFail (enabled, message) { | ||
@@ -975,2 +1007,3 @@ argsert('[boolean|string] [string]', [enabled, message], arguments.length) | ||
options.configuration = pkgUp()['yargs'] || {} | ||
const parsed = Parser.detailed(args, options) | ||
@@ -1118,3 +1151,2 @@ let argv = parsed.argv | ||
validation.nonOptionCount(argv) | ||
validation.missingArgumentValue(argv) | ||
validation.requiredArguments(argv) | ||
@@ -1121,0 +1153,0 @@ if (strict) validation.unknownArguments(argv, aliases, positionalMap) |
{ | ||
"name": "nyc", | ||
"version": "11.5.0", | ||
"version": "11.6.0", | ||
"description": "the Istanbul command line interface", | ||
@@ -88,3 +88,3 @@ "main": "index.js", | ||
"istanbul-lib-hook": "^1.1.0", | ||
"istanbul-lib-instrument": "^1.9.2", | ||
"istanbul-lib-instrument": "^1.10.0", | ||
"istanbul-lib-report": "^1.1.3", | ||
@@ -102,3 +102,3 @@ "istanbul-lib-source-maps": "^1.2.3", | ||
"test-exclude": "^4.2.0", | ||
"yargs": "^10.0.3", | ||
"yargs": "11.1.0", | ||
"yargs-parser": "^8.0.0" | ||
@@ -121,3 +121,2 @@ }, | ||
"source-map-support": "^0.4.6", | ||
"split-lines": "^1.0.0", | ||
"standard": "^9.0.2", | ||
@@ -124,0 +123,0 @@ "standard-version": "^4.0.0", |
@@ -275,2 +275,3 @@ # nyc | ||
], | ||
"ignore-class-method": "methodToIgnore", | ||
"reporter": [ | ||
@@ -348,2 +349,15 @@ "lcov", | ||
## Ignoring Methods | ||
There may be some methods that you want to universally ignore out of your classes | ||
rather than having to ignore every instance of that method: | ||
```json | ||
{ | ||
"nyc": { | ||
"ignore-class-method": "render" | ||
} | ||
} | ||
``` | ||
## Integrating with coveralls | ||
@@ -350,0 +364,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 3 instances in 1 package
14226088
20
4817
2
90
222618
443
198
Updatedyargs@11.1.0