diff options
author | Rebecca Turner <me@re-becca.org> | 2017-02-23 01:24:24 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2017-02-24 02:53:52 +0300 |
commit | 052dfb623da508f2b5f681da0258125552a18a4a (patch) | |
tree | 3893438149e2415147011a2ce7763aeeb996ba5f /node_modules | |
parent | 549dcff58c7aaa1e7ba71abaa14008fdf2697297 (diff) |
validate-npm-package-name@3.0.0
Remove ablist language in README
Stop allowing ~'!()* in package names.
Credit: @tomdale
Credit: @chrisdickinson
Diffstat (limited to 'node_modules')
9 files changed, 257 insertions, 140 deletions
diff --git a/node_modules/validate-npm-package-name/.travis.yml b/node_modules/validate-npm-package-name/.travis.yml new file mode 100644 index 000000000..54de0d2d1 --- /dev/null +++ b/node_modules/validate-npm-package-name/.travis.yml @@ -0,0 +1,6 @@ +sudo: false +language: node_js +node_js: + - '0.10' + - '4' + - '6' diff --git a/node_modules/validate-npm-package-name/README.md b/node_modules/validate-npm-package-name/README.md index d967fdda2..95d04a4c8 100644 --- a/node_modules/validate-npm-package-name/README.md +++ b/node_modules/validate-npm-package-name/README.md @@ -28,6 +28,7 @@ Below is a list of rules that valid `npm` package name should conform to. - package name must *not* contain any non-url-safe characters (since name ends up being part of a URL) - package name should not start with `.` or `_` - package name should *not* contain any leading or trailing spaces +- package name should *not* contain any of the following characters: `~)('!*` - package name *cannot* be the same as a node.js/io.js core module nor a reserved/blacklisted name. For example, the following names are invalid: + http + stream @@ -47,7 +48,7 @@ validate("some-package") validate("example.com") validate("under_score") validate("123numeric") -validate("crazy!") +validate("excited!") validate("@npm/thingy") validate("@jane/foo.js") ``` @@ -91,7 +92,7 @@ a change in the value of `validForNewPackages` property, and a warnings array will be present: ```js -validate("cRaZY-paCkAgE-with-mixed-case-and-more-than-214-characters-----------------------------------------------------------------------------------------------------------------------------------------------------------") +validate("eLaBorAtE-paCkAgE-with-mixed-case-and-more-than-214-characters-----------------------------------------------------------------------------------------------------------------------------------------------------------") ``` returns: diff --git a/node_modules/validate-npm-package-name/index.js b/node_modules/validate-npm-package-name/index.js index 66a1d4732..eb43fa25e 100644 --- a/node_modules/validate-npm-package-name/index.js +++ b/node_modules/validate-npm-package-name/index.js @@ -1,75 +1,79 @@ -var scopedPackagePattern = new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$"); -var builtins = require("builtins") -var blacklist = [ - "node_modules", - "favicon.ico" -]; +'use strict' -var validate = module.exports = function(name) { +var scopedPackagePattern = new RegExp('^(?:@([^/]+?)[/])?([^/]+?)$') +var builtins = require('builtins') +var blacklist = [ + 'node_modules', + 'favicon.ico' +] +var validate = module.exports = function (name) { var warnings = [] var errors = [] if (name === null) { - errors.push("name cannot be null") + errors.push('name cannot be null') return done(warnings, errors) } if (name === undefined) { - errors.push("name cannot be undefined") + errors.push('name cannot be undefined') return done(warnings, errors) } - if (typeof name !== "string") { - errors.push("name must be a string") + if (typeof name !== 'string') { + errors.push('name must be a string') return done(warnings, errors) } if (!name.length) { - errors.push("name length must be greater than zero") + errors.push('name length must be greater than zero') } if (name.match(/^\./)) { - errors.push("name cannot start with a period") + errors.push('name cannot start with a period') } if (name.match(/^_/)) { - errors.push("name cannot start with an underscore") + errors.push('name cannot start with an underscore') } if (name.trim() !== name) { - errors.push("name cannot contain leading or trailing spaces") + errors.push('name cannot contain leading or trailing spaces') } // No funny business - blacklist.forEach(function(blacklistedName){ + blacklist.forEach(function (blacklistedName) { if (name.toLowerCase() === blacklistedName) { - errors.push(blacklistedName + " is a blacklisted name") + errors.push(blacklistedName + ' is a blacklisted name') } }) // Generate warnings for stuff that used to be allowed // core module names like http, events, util, etc - builtins.forEach(function(builtin){ + builtins.forEach(function (builtin) { if (name.toLowerCase() === builtin) { - warnings.push(builtin + " is a core module name") + warnings.push(builtin + ' is a core module name') } }) // really-long-package-names-------------------------------such--length-----many---wow // the thisisareallyreallylongpackagenameitshouldpublishdowenowhavealimittothelengthofpackagenames-poch. if (name.length > 214) { - warnings.push("name can no longer contain more than 214 characters") + warnings.push('name can no longer contain more than 214 characters') } // mIxeD CaSe nAMEs if (name.toLowerCase() !== name) { - warnings.push("name can no longer contain capital letters") + warnings.push('name can no longer contain capital letters') } - if (encodeURIComponent(name) !== name) { + if (/[~'!()*]/.test(name.split('/').slice(-1)[0])) { + warnings.push('name can no longer contain special characters ("~\'!()*")') + } + if (encodeURIComponent(name) !== name) { // Maybe it's a scoped package name, like @user/package var nameMatch = name.match(scopedPackagePattern) if (nameMatch) { @@ -80,11 +84,10 @@ var validate = module.exports = function(name) { } } - errors.push("name can only contain URL-friendly characters") + errors.push('name can only contain URL-friendly characters') } return done(warnings, errors) - } validate.scopedPackagePattern = scopedPackagePattern diff --git a/node_modules/validate-npm-package-name/node_modules/builtins/License b/node_modules/validate-npm-package-name/node_modules/builtins/License new file mode 100644 index 000000000..b142e5dc0 --- /dev/null +++ b/node_modules/validate-npm-package-name/node_modules/builtins/License @@ -0,0 +1,20 @@ +Copyright (c) 2015 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/validate-npm-package-name/node_modules/builtins/builtins.json b/node_modules/validate-npm-package-name/node_modules/builtins/builtins.json index c52221d77..45c052256 100644 --- a/node_modules/validate-npm-package-name/node_modules/builtins/builtins.json +++ b/node_modules/validate-npm-package-name/node_modules/builtins/builtins.json @@ -3,8 +3,10 @@ "buffer", "child_process", "cluster", + "console", "constants", "crypto", + "dgram", "dns", "domain", "events", @@ -15,17 +17,19 @@ "net", "os", "path", + "process", "punycode", "querystring", + "readline", "repl", "stream", "string_decoder", "timers", "tls", "tty", - "dgram", "url", "util", + "v8", "vm", "zlib" ] diff --git a/node_modules/validate-npm-package-name/node_modules/builtins/package.json b/node_modules/validate-npm-package-name/node_modules/builtins/package.json index c5ec77f13..49b8d049c 100644 --- a/node_modules/validate-npm-package-name/node_modules/builtins/package.json +++ b/node_modules/validate-npm-package-name/node_modules/builtins/package.json @@ -1,34 +1,61 @@ { - "name": "builtins", - "version": "0.0.7", - "description": "List of node.js builtin modules", - "repository": { - "type": "git", - "url": "git://github.com/juliangruber/builtins.git" - }, - "license": "MIT", - "main": "builtins.json", - "publishConfig": { - "registry": "https://registry.npmjs.org" + "_args": [ + [ + { + "raw": "builtins@^1.0.3", + "scope": null, + "escapedName": "builtins", + "name": "builtins", + "rawSpec": "^1.0.3", + "spec": ">=1.0.3 <2.0.0", + "type": "range" + }, + "/Users/rebecca/code/npm/node_modules/validate-npm-package-name" + ] + ], + "_from": "builtins@>=1.0.3 <2.0.0", + "_id": "builtins@1.0.3", + "_inCache": true, + "_location": "/validate-npm-package-name/builtins", + "_nodeVersion": "4.2.1", + "_npmUser": { + "name": "juliangruber", + "email": "julian@juliangruber.com" }, - "scripts": { - "test": "node -e \"require('./builtins.json')\"" + "_npmVersion": "2.14.7", + "_phantomChildren": {}, + "_requested": { + "raw": "builtins@^1.0.3", + "scope": null, + "escapedName": "builtins", + "name": "builtins", + "rawSpec": "^1.0.3", + "spec": ">=1.0.3 <2.0.0", + "type": "range" }, + "_requiredBy": [ + "/validate-npm-package-name" + ], + "_resolved": "https://registry.npmjs.org/builtins/-/builtins-1.0.3.tgz", + "_shasum": "cb94faeb61c8696451db36534e1422f94f0aee88", + "_shrinkwrap": null, + "_spec": "builtins@^1.0.3", + "_where": "/Users/rebecca/code/npm/node_modules/validate-npm-package-name", "bugs": { "url": "https://github.com/juliangruber/builtins/issues" }, - "homepage": "https://github.com/juliangruber/builtins", - "_id": "builtins@0.0.7", + "dependencies": {}, + "description": "List of node.js builtin modules", + "devDependencies": {}, + "directories": {}, "dist": { - "shasum": "355219cd6cf18dbe7c01cc7fd2dce765cfdc549a", - "tarball": "http://registry.npmjs.org/builtins/-/builtins-0.0.7.tgz" - }, - "_from": "builtins@0.0.7", - "_npmVersion": "1.3.22", - "_npmUser": { - "name": "juliangruber", - "email": "julian@juliangruber.com" + "shasum": "cb94faeb61c8696451db36534e1422f94f0aee88", + "tarball": "https://registry.npmjs.org/builtins/-/builtins-1.0.3.tgz" }, + "gitHead": "be046dcd4e338cadff24d3330ad43d65dfd80bb3", + "homepage": "https://github.com/juliangruber/builtins#readme", + "license": "MIT", + "main": "builtins.json", "maintainers": [ { "name": "juliangruber", @@ -39,8 +66,18 @@ "email": "tj@segment.io" } ], - "directories": {}, - "_shasum": "355219cd6cf18dbe7c01cc7fd2dce765cfdc549a", - "_resolved": "https://registry.npmjs.org/builtins/-/builtins-0.0.7.tgz", - "readme": "ERROR: No README data found!" + "name": "builtins", + "optionalDependencies": {}, + "publishConfig": { + "registry": "https://registry.npmjs.org" + }, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/juliangruber/builtins.git" + }, + "scripts": { + "test": "node test.js" + }, + "version": "1.0.3" } diff --git a/node_modules/validate-npm-package-name/node_modules/builtins/test.js b/node_modules/validate-npm-package-name/node_modules/builtins/test.js new file mode 100644 index 000000000..ffbe8389c --- /dev/null +++ b/node_modules/validate-npm-package-name/node_modules/builtins/test.js @@ -0,0 +1,5 @@ +var builtins = require('./builtins'); + +builtins.forEach(function(name){ + require(name); +}); diff --git a/node_modules/validate-npm-package-name/package.json b/node_modules/validate-npm-package-name/package.json index 5b706da2d..a94b9a33e 100644 --- a/node_modules/validate-npm-package-name/package.json +++ b/node_modules/validate-npm-package-name/package.json @@ -1,66 +1,100 @@ { - "name": "validate-npm-package-name", - "version": "2.2.2", - "description": "Give me a string and I'll tell you if it's a valid npm package name", - "main": "index.js", - "directories": { - "test": "test" + "_args": [ + [ + { + "raw": "validate-npm-package-name@3.0.0", + "scope": null, + "escapedName": "validate-npm-package-name", + "name": "validate-npm-package-name", + "rawSpec": "3.0.0", + "spec": "3.0.0", + "type": "version" + }, + "/Users/rebecca/code/npm" + ] + ], + "_from": "validate-npm-package-name@3.0.0", + "_id": "validate-npm-package-name@3.0.0", + "_inCache": true, + "_location": "/validate-npm-package-name", + "_nodeVersion": "6.9.4", + "_npmOperationalInternal": { + "host": "packages-18-east.internal.npmjs.com", + "tmp": "tmp/validate-npm-package-name-3.0.0.tgz_1487026281960_0.640724653378129" + }, + "_npmUser": { + "name": "chrisdickinson", + "email": "chris@neversaw.us" + }, + "_npmVersion": "4.1.1", + "_phantomChildren": {}, + "_requested": { + "raw": "validate-npm-package-name@3.0.0", + "scope": null, + "escapedName": "validate-npm-package-name", + "name": "validate-npm-package-name", + "rawSpec": "3.0.0", + "spec": "3.0.0", + "type": "version" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz", + "_shasum": "5fa912d81eb7d0c74afc140de7317f0ca7df437e", + "_shrinkwrap": null, + "_spec": "validate-npm-package-name@3.0.0", + "_where": "/Users/rebecca/code/npm", + "author": { + "name": "zeke" + }, + "bugs": { + "url": "https://github.com/npm/validate-npm-package-name/issues" }, "dependencies": { - "builtins": "0.0.7" + "builtins": "^1.0.3" }, + "description": "Give me a string and I'll tell you if it's a valid npm package name", "devDependencies": { - "tap": "^0.4.13" + "standard": "^8.6.0", + "tap": "^10.0.0" }, - "scripts": { - "test": "tap test/*.js" + "directories": { + "test": "test" }, - "repository": { - "type": "git", - "url": "git+https://github.com/npm/validate-npm-package-name.git" + "dist": { + "shasum": "5fa912d81eb7d0c74afc140de7317f0ca7df437e", + "tarball": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz" }, + "gitHead": "ddf73c79e920b59413485ca2ae50a38552156d62", + "homepage": "https://github.com/npm/validate-npm-package-name", "keywords": [ "npm", "package", "names", "validation" ], - "author": { - "name": "zeke" - }, "license": "ISC", - "bugs": { - "url": "https://github.com/npm/validate-npm-package-name/issues" - }, - "homepage": "https://github.com/npm/validate-npm-package-name", - "gitHead": "3af92c881549f1b96f05ab6bfb5768bba94ad72d", - "_id": "validate-npm-package-name@2.2.2", - "_shasum": "f65695b22f7324442019a3c7fa39a6e7fd299085", - "_from": "validate-npm-package-name@>=2.2.2 <2.3.0", - "_npmVersion": "3.0.0", - "_nodeVersion": "0.12.5", - "_npmUser": { - "name": "zkat", - "email": "kat@sykosomatic.org" - }, - "dist": { - "shasum": "f65695b22f7324442019a3c7fa39a6e7fd299085", - "tarball": "http://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-2.2.2.tgz" - }, + "main": "index.js", "maintainers": [ { - "name": "zeke", - "email": "zeke@sikelianos.com" - }, - { - "name": "bcoe", - "email": "ben@npmjs.com" - }, - { - "name": "zkat", - "email": "kat@sykosomatic.org" + "name": "chrisdickinson", + "email": "chris@neversaw.us" } ], - "_resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-2.2.2.tgz", - "readme": "ERROR: No README data found!" + "name": "validate-npm-package-name", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/validate-npm-package-name.git" + }, + "scripts": { + "cov:test": "TAP_FLAGS='--cov' npm run test:code", + "test": "npm run test:code && npm run test:style", + "test:code": "tap ${TAP_FLAGS:-'--'} test/*.js", + "test:style": "standard" + }, + "version": "3.0.0" } diff --git a/node_modules/validate-npm-package-name/test/index.js b/node_modules/validate-npm-package-name/test/index.js index 1a7dca5de..1f0bc6123 100644 --- a/node_modules/validate-npm-package-name/test/index.js +++ b/node_modules/validate-npm-package-name/test/index.js @@ -1,102 +1,109 @@ -var validate = require("..") -var test = require("tap").test -var path = require("path") -var fs = require("fs") +'use strict' -test("validate-npm-package-name", function (t) { +var validate = require('..') +var test = require('tap').test +test('validate-npm-package-name', function (t) { // Traditional - t.deepEqual(validate("some-package"), {validForNewPackages: true, validForOldPackages: true}) - t.deepEqual(validate("example.com"), {validForNewPackages: true, validForOldPackages: true}) - t.deepEqual(validate("under_score"), {validForNewPackages: true, validForOldPackages: true}) - t.deepEqual(validate("period.js"), {validForNewPackages: true, validForOldPackages: true}) - t.deepEqual(validate("123numeric"), {validForNewPackages: true, validForOldPackages: true}) - t.deepEqual(validate("crazy!"), {validForNewPackages: true, validForOldPackages: true}) + t.deepEqual(validate('some-package'), {validForNewPackages: true, validForOldPackages: true}) + t.deepEqual(validate('example.com'), {validForNewPackages: true, validForOldPackages: true}) + t.deepEqual(validate('under_score'), {validForNewPackages: true, validForOldPackages: true}) + t.deepEqual(validate('period.js'), {validForNewPackages: true, validForOldPackages: true}) + t.deepEqual(validate('123numeric'), {validForNewPackages: true, validForOldPackages: true}) + t.deepEqual(validate('crazy!'), { + validForNewPackages: false, + validForOldPackages: true, + warnings: ['name can no longer contain special characters ("~\'!()*")'] + }) // Scoped (npm 2+) - t.deepEqual(validate("@npm/thingy"), {validForNewPackages: true, validForOldPackages: true}) - t.deepEqual(validate("@npm-zors/money!time.js"), {validForNewPackages: true, validForOldPackages: true}) + t.deepEqual(validate('@npm/thingy'), {validForNewPackages: true, validForOldPackages: true}) + t.deepEqual(validate('@npm-zors/money!time.js'), { + validForNewPackages: false, + validForOldPackages: true, + warnings: ['name can no longer contain special characters ("~\'!()*")'] + }) // Invalid - t.deepEqual(validate(""), { + t.deepEqual(validate(''), { validForNewPackages: false, validForOldPackages: false, - errors: ["name length must be greater than zero"]}) + errors: ['name length must be greater than zero']}) - t.deepEqual(validate(""), { + t.deepEqual(validate(''), { validForNewPackages: false, validForOldPackages: false, - errors: ["name length must be greater than zero"]}) + errors: ['name length must be greater than zero']}) - t.deepEqual(validate(".start-with-period"), { + t.deepEqual(validate('.start-with-period'), { validForNewPackages: false, validForOldPackages: false, - errors: ["name cannot start with a period"]}) + errors: ['name cannot start with a period']}) - t.deepEqual(validate("_start-with-underscore"), { + t.deepEqual(validate('_start-with-underscore'), { validForNewPackages: false, validForOldPackages: false, - errors: ["name cannot start with an underscore"]}) + errors: ['name cannot start with an underscore']}) - t.deepEqual(validate("contain:colons"), { + t.deepEqual(validate('contain:colons'), { validForNewPackages: false, validForOldPackages: false, - errors: ["name can only contain URL-friendly characters"]}) + errors: ['name can only contain URL-friendly characters']}) - t.deepEqual(validate(" leading-space"), { + t.deepEqual(validate(' leading-space'), { validForNewPackages: false, validForOldPackages: false, - errors: ["name cannot contain leading or trailing spaces", "name can only contain URL-friendly characters"]}) + errors: ['name cannot contain leading or trailing spaces', 'name can only contain URL-friendly characters']}) - t.deepEqual(validate("trailing-space "), { + t.deepEqual(validate('trailing-space '), { validForNewPackages: false, validForOldPackages: false, - errors: ["name cannot contain leading or trailing spaces", "name can only contain URL-friendly characters"]}) + errors: ['name cannot contain leading or trailing spaces', 'name can only contain URL-friendly characters']}) - t.deepEqual(validate("s/l/a/s/h/e/s"), { + t.deepEqual(validate('s/l/a/s/h/e/s'), { validForNewPackages: false, validForOldPackages: false, - errors: ["name can only contain URL-friendly characters"]}) + errors: ['name can only contain URL-friendly characters']}) - t.deepEqual(validate("node_modules"), { + t.deepEqual(validate('node_modules'), { validForNewPackages: false, validForOldPackages: false, - errors: ["node_modules is a blacklisted name"]}) + errors: ['node_modules is a blacklisted name']}) - t.deepEqual(validate("favicon.ico"), { + t.deepEqual(validate('favicon.ico'), { validForNewPackages: false, validForOldPackages: false, - errors: ["favicon.ico is a blacklisted name"]}) + errors: ['favicon.ico is a blacklisted name']}) // Node/IO Core - t.deepEqual(validate("http"), { + t.deepEqual(validate('http'), { validForNewPackages: false, validForOldPackages: true, - warnings: ["http is a core module name"]}) + warnings: ['http is a core module name']}) // Long Package Names - t.deepEqual(validate("ifyouwanttogetthesumoftwonumberswherethosetwonumbersarechosenbyfindingthelargestoftwooutofthreenumbersandsquaringthemwhichismultiplyingthembyitselfthenyoushouldinputthreenumbersintothisfunctionanditwilldothatforyou-"), { + t.deepEqual(validate('ifyouwanttogetthesumoftwonumberswherethosetwonumbersarechosenbyfindingthelargestoftwooutofthreenumbersandsquaringthemwhichismultiplyingthembyitselfthenyoushouldinputthreenumbersintothisfunctionanditwilldothatforyou-'), { validForNewPackages: false, validForOldPackages: true, - warnings: ["name can no longer contain more than 214 characters"] + warnings: ['name can no longer contain more than 214 characters'] }) - t.deepEqual(validate("ifyouwanttogetthesumoftwonumberswherethosetwonumbersarechosenbyfindingthelargestoftwooutofthreenumbersandsquaringthemwhichismultiplyingthembyitselfthenyoushouldinputthreenumbersintothisfunctionanditwilldothatforyou"), { + t.deepEqual(validate('ifyouwanttogetthesumoftwonumberswherethosetwonumbersarechosenbyfindingthelargestoftwooutofthreenumbersandsquaringthemwhichismultiplyingthembyitselfthenyoushouldinputthreenumbersintothisfunctionanditwilldothatforyou'), { validForNewPackages: true, validForOldPackages: true }) // Legacy Mixed-Case - t.deepEqual(validate("CAPITAL-LETTERS"), { + t.deepEqual(validate('CAPITAL-LETTERS'), { validForNewPackages: false, validForOldPackages: true, - warnings: ["name can no longer contain capital letters"]}) + warnings: ['name can no longer contain capital letters']}) t.end() }) |