diff options
11 files changed, 559 insertions, 0 deletions
diff --git a/node_modules/init-package-json/node_modules/validate-npm-package-name/.npmignore b/node_modules/init-package-json/node_modules/validate-npm-package-name/.npmignore new file mode 100644 index 000000000..3c3629e64 --- /dev/null +++ b/node_modules/init-package-json/node_modules/validate-npm-package-name/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/init-package-json/node_modules/validate-npm-package-name/LICENSE b/node_modules/init-package-json/node_modules/validate-npm-package-name/LICENSE new file mode 100644 index 000000000..fdcd63b30 --- /dev/null +++ b/node_modules/init-package-json/node_modules/validate-npm-package-name/LICENSE @@ -0,0 +1,6 @@ +Copyright (c) 2015, npm, Inc + + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/init-package-json/node_modules/validate-npm-package-name/README.md b/node_modules/init-package-json/node_modules/validate-npm-package-name/README.md new file mode 100644 index 000000000..d967fdda2 --- /dev/null +++ b/node_modules/init-package-json/node_modules/validate-npm-package-name/README.md @@ -0,0 +1,119 @@ +# validate-npm-package-name + +Give me a string and I'll tell you if it's a valid `npm` package name. + +This package exports a single synchronous function that takes a `string` as +input and returns an object with two properties: + +- `validForNewPackages` :: `Boolean` +- `validForOldPackages` :: `Boolean` + +## Contents + +- [Naming rules](#naming-rules) +- [Examples](#examples) + + [Valid Names](#valid-names) + + [Invalid Names](#invalid-names) +- [Legacy Names](#legacy-names) +- [Tests](#tests) +- [License](#license) + +## Naming Rules + +Below is a list of rules that valid `npm` package name should conform to. + +- package name length should be greater than zero +- all the characters in the package name must be lowercase i.e., no uppercase or mixed case names are allowed +- package name *can* consist of hyphens +- 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 *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 + + node_modules + + favicon.ico +- package name length cannot exceed 214 + + +## Examples + +### Valid Names + +```js +var validate = require("validate-npm-package-name") + +validate("some-package") +validate("example.com") +validate("under_score") +validate("123numeric") +validate("crazy!") +validate("@npm/thingy") +validate("@jane/foo.js") +``` + +All of the above names are valid, so you'll get this object back: + +```js +{ + validForNewPackages: true, + validForOldPackages: true +} +``` + +### Invalid Names + +```js +validate(" leading-space:and:weirdchars") +``` + +That was never a valid package name, so you get this: + +```js +{ + validForNewPackages: false, + validForOldPackages: false, + errors: [ + 'name cannot contain leading or trailing spaces', + 'name can only contain URL-friendly characters' + ] +} +``` + +## Legacy Names + +In the old days of npm, package names were wild. They could have capital +letters in them. They could be really long. They could be the name of an +existing module in node core. + +If you give this function a package name that **used to be valid**, you'll see +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-----------------------------------------------------------------------------------------------------------------------------------------------------------") +``` + +returns: + +```js +{ + validForNewPackages: false, + validForOldPackages: true, + warnings: [ + "name can no longer contain capital letters", + "name can no longer contain more than 214 characters" + ] +} +``` + +## Tests + +```sh +npm install +npm test +``` + +## License + +ISC diff --git a/node_modules/init-package-json/node_modules/validate-npm-package-name/index.js b/node_modules/init-package-json/node_modules/validate-npm-package-name/index.js new file mode 100644 index 000000000..66a1d4732 --- /dev/null +++ b/node_modules/init-package-json/node_modules/validate-npm-package-name/index.js @@ -0,0 +1,102 @@ +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") + return done(warnings, errors) + } + + if (name === undefined) { + errors.push("name cannot be undefined") + return done(warnings, errors) + } + + 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") + } + + if (name.match(/^\./)) { + errors.push("name cannot start with a period") + } + + if (name.match(/^_/)) { + errors.push("name cannot start with an underscore") + } + + if (name.trim() !== name) { + errors.push("name cannot contain leading or trailing spaces") + } + + // No funny business + blacklist.forEach(function(blacklistedName){ + if (name.toLowerCase() === blacklistedName) { + 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){ + if (name.toLowerCase() === builtin) { + 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") + } + + // mIxeD CaSe nAMEs + if (name.toLowerCase() !== name) { + warnings.push("name can no longer contain capital letters") + } + + if (encodeURIComponent(name) !== name) { + + // Maybe it's a scoped package name, like @user/package + var nameMatch = name.match(scopedPackagePattern) + if (nameMatch) { + var user = nameMatch[1] + var pkg = nameMatch[2] + if (encodeURIComponent(user) === user && encodeURIComponent(pkg) === pkg) { + return done(warnings, errors) + } + } + + errors.push("name can only contain URL-friendly characters") + } + + return done(warnings, errors) + +} + +validate.scopedPackagePattern = scopedPackagePattern + +var done = function (warnings, errors) { + var result = { + validForNewPackages: errors.length === 0 && warnings.length === 0, + validForOldPackages: errors.length === 0, + warnings: warnings, + errors: errors + } + if (!result.warnings.length) delete result.warnings + if (!result.errors.length) delete result.errors + return result +} diff --git a/node_modules/init-package-json/node_modules/validate-npm-package-name/node_modules/builtins/.travis.yml b/node_modules/init-package-json/node_modules/validate-npm-package-name/node_modules/builtins/.travis.yml new file mode 100644 index 000000000..cc4dba29d --- /dev/null +++ b/node_modules/init-package-json/node_modules/validate-npm-package-name/node_modules/builtins/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.8" + - "0.10" diff --git a/node_modules/init-package-json/node_modules/validate-npm-package-name/node_modules/builtins/History.md b/node_modules/init-package-json/node_modules/validate-npm-package-name/node_modules/builtins/History.md new file mode 100644 index 000000000..0eb45c420 --- /dev/null +++ b/node_modules/init-package-json/node_modules/validate-npm-package-name/node_modules/builtins/History.md @@ -0,0 +1,39 @@ + +0.0.7 / 2014-09-01 +================== + + * update .repository + +0.0.6 / 2014-09-01 +================== + + * add travis + * add test script + * add constants + +0.0.5 / 2014-06-27 +================== + + * add module + * publish to public npm + +0.0.4 / 2014-04-25 +================== + + * add timers + +0.0.3 / 2014-02-22 +================== + + * add buffer + +0.0.2 / 2014-02-11 +================== + + * add assert + +0.0.1 / 2014-02-11 +================== + + * add main + * initial commit diff --git a/node_modules/init-package-json/node_modules/validate-npm-package-name/node_modules/builtins/Readme.md b/node_modules/init-package-json/node_modules/validate-npm-package-name/node_modules/builtins/Readme.md new file mode 100644 index 000000000..96f4b1f6c --- /dev/null +++ b/node_modules/init-package-json/node_modules/validate-npm-package-name/node_modules/builtins/Readme.md @@ -0,0 +1,18 @@ + +# builtins + + List of node.js [builtin modules](http://nodejs.org/api/). + + [![build status](https://secure.travis-ci.org/juliangruber/builtins.svg)](http://travis-ci.org/juliangruber/builtins) + +## Example + +```js +var builtins = require('builtins'); + +assert(builtins.indexOf('http') > -1); +``` + +## License + + MIT diff --git a/node_modules/init-package-json/node_modules/validate-npm-package-name/node_modules/builtins/builtins.json b/node_modules/init-package-json/node_modules/validate-npm-package-name/node_modules/builtins/builtins.json new file mode 100644 index 000000000..c52221d77 --- /dev/null +++ b/node_modules/init-package-json/node_modules/validate-npm-package-name/node_modules/builtins/builtins.json @@ -0,0 +1,31 @@ +[ + "assert", + "buffer", + "child_process", + "cluster", + "constants", + "crypto", + "dns", + "domain", + "events", + "fs", + "http", + "https", + "module", + "net", + "os", + "path", + "punycode", + "querystring", + "repl", + "stream", + "string_decoder", + "timers", + "tls", + "tty", + "dgram", + "url", + "util", + "vm", + "zlib" +] diff --git a/node_modules/init-package-json/node_modules/validate-npm-package-name/node_modules/builtins/package.json b/node_modules/init-package-json/node_modules/validate-npm-package-name/node_modules/builtins/package.json new file mode 100644 index 000000000..34b753005 --- /dev/null +++ b/node_modules/init-package-json/node_modules/validate-npm-package-name/node_modules/builtins/package.json @@ -0,0 +1,62 @@ +{ + "_args": [ + [ + { + "raw": "builtins@https://registry.npmjs.org/builtins/-/builtins-0.0.7.tgz", + "scope": null, + "escapedName": "builtins", + "name": "builtins", + "rawSpec": "https://registry.npmjs.org/builtins/-/builtins-0.0.7.tgz", + "spec": "https://registry.npmjs.org/builtins/-/builtins-0.0.7.tgz", + "type": "remote" + }, + "/Users/rebecca/code/release/npm-4" + ] + ], + "_from": "builtins@0.0.7", + "_id": "builtins@0.0.7", + "_inCache": true, + "_location": "/init-package-json/validate-npm-package-name/builtins", + "_phantomChildren": {}, + "_requested": { + "raw": "builtins@https://registry.npmjs.org/builtins/-/builtins-0.0.7.tgz", + "scope": null, + "escapedName": "builtins", + "name": "builtins", + "rawSpec": "https://registry.npmjs.org/builtins/-/builtins-0.0.7.tgz", + "spec": "https://registry.npmjs.org/builtins/-/builtins-0.0.7.tgz", + "type": "remote" + }, + "_requiredBy": [ + "/init-package-json/validate-npm-package-name" + ], + "_resolved": "https://registry.npmjs.org/builtins/-/builtins-0.0.7.tgz", + "_shasum": "355219cd6cf18dbe7c01cc7fd2dce765cfdc549a", + "_shrinkwrap": null, + "_spec": "builtins@https://registry.npmjs.org/builtins/-/builtins-0.0.7.tgz", + "_where": "/Users/rebecca/code/release/npm-4", + "bugs": { + "url": "https://github.com/juliangruber/builtins/issues" + }, + "dependencies": {}, + "description": "List of node.js builtin modules", + "devDependencies": {}, + "homepage": "https://github.com/juliangruber/builtins#readme", + "license": "MIT", + "main": "builtins.json", + "name": "builtins", + "optionalDependencies": {}, + "publishConfig": { + "registry": "https://registry.npmjs.org" + }, + "readme": "\n# builtins\n\n List of node.js [builtin modules](http://nodejs.org/api/).\n\n [![build status](https://secure.travis-ci.org/juliangruber/builtins.svg)](http://travis-ci.org/juliangruber/builtins)\n\n## Example\n\n```js\nvar builtins = require('builtins');\n\nassert(builtins.indexOf('http') > -1);\n```\n\n## License\n\n MIT\n", + "readmeFilename": "Readme.md", + "repository": { + "type": "git", + "url": "git+https://github.com/juliangruber/builtins.git" + }, + "scripts": { + "test": "node -e \"require('./builtins.json')\"" + }, + "version": "0.0.7" +} diff --git a/node_modules/init-package-json/node_modules/validate-npm-package-name/package.json b/node_modules/init-package-json/node_modules/validate-npm-package-name/package.json new file mode 100644 index 000000000..df3994705 --- /dev/null +++ b/node_modules/init-package-json/node_modules/validate-npm-package-name/package.json @@ -0,0 +1,75 @@ +{ + "_args": [ + [ + { + "raw": "validate-npm-package-name@https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-2.2.2.tgz", + "scope": null, + "escapedName": "validate-npm-package-name", + "name": "validate-npm-package-name", + "rawSpec": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-2.2.2.tgz", + "spec": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-2.2.2.tgz", + "type": "remote" + }, + "/Users/rebecca/code/release/npm-4" + ] + ], + "_from": "validate-npm-package-name@>=2.0.1 <3.0.0", + "_id": "validate-npm-package-name@2.2.2", + "_inCache": true, + "_location": "/init-package-json/validate-npm-package-name", + "_phantomChildren": {}, + "_requested": { + "raw": "validate-npm-package-name@https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-2.2.2.tgz", + "scope": null, + "escapedName": "validate-npm-package-name", + "name": "validate-npm-package-name", + "rawSpec": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-2.2.2.tgz", + "spec": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-2.2.2.tgz", + "type": "remote" + }, + "_requiredBy": [ + "/init-package-json" + ], + "_resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-2.2.2.tgz", + "_shasum": "f65695b22f7324442019a3c7fa39a6e7fd299085", + "_shrinkwrap": null, + "_spec": "validate-npm-package-name@https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-2.2.2.tgz", + "_where": "/Users/rebecca/code/release/npm-4", + "author": { + "name": "zeke" + }, + "bugs": { + "url": "https://github.com/npm/validate-npm-package-name/issues" + }, + "dependencies": { + "builtins": "0.0.7" + }, + "description": "Give me a string and I'll tell you if it's a valid npm package name", + "devDependencies": { + "tap": "^0.4.13" + }, + "directories": { + "test": "test" + }, + "homepage": "https://github.com/npm/validate-npm-package-name", + "keywords": [ + "npm", + "package", + "names", + "validation" + ], + "license": "ISC", + "main": "index.js", + "name": "validate-npm-package-name", + "optionalDependencies": {}, + "readme": "# validate-npm-package-name\n\nGive me a string and I'll tell you if it's a valid `npm` package name.\n\nThis package exports a single synchronous function that takes a `string` as\ninput and returns an object with two properties:\n\n- `validForNewPackages` :: `Boolean`\n- `validForOldPackages` :: `Boolean`\n\n## Contents\n\n- [Naming rules](#naming-rules)\n- [Examples](#examples)\n + [Valid Names](#valid-names)\n + [Invalid Names](#invalid-names)\n- [Legacy Names](#legacy-names)\n- [Tests](#tests)\n- [License](#license)\n\n## Naming Rules\n\nBelow is a list of rules that valid `npm` package name should conform to.\n\n- package name length should be greater than zero\n- all the characters in the package name must be lowercase i.e., no uppercase or mixed case names are allowed\n- package name *can* consist of hyphens\n- package name must *not* contain any non-url-safe characters (since name ends up being part of a URL)\n- package name should not start with `.` or `_`\n- package name should *not* contain any leading or trailing spaces\n- 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:\n + http\n + stream\n + node_modules\n + favicon.ico\n- package name length cannot exceed 214\n\n\n## Examples\n\n### Valid Names\n\n```js\nvar validate = require(\"validate-npm-package-name\")\n\nvalidate(\"some-package\")\nvalidate(\"example.com\")\nvalidate(\"under_score\")\nvalidate(\"123numeric\")\nvalidate(\"crazy!\")\nvalidate(\"@npm/thingy\")\nvalidate(\"@jane/foo.js\")\n```\n\nAll of the above names are valid, so you'll get this object back:\n\n```js\n{\n validForNewPackages: true,\n validForOldPackages: true\n}\n```\n\n### Invalid Names\n\n```js\nvalidate(\" leading-space:and:weirdchars\")\n```\n\nThat was never a valid package name, so you get this:\n\n```js\n{\n validForNewPackages: false,\n validForOldPackages: false,\n errors: [\n 'name cannot contain leading or trailing spaces',\n 'name can only contain URL-friendly characters'\n ]\n}\n```\n\n## Legacy Names\n\nIn the old days of npm, package names were wild. They could have capital\nletters in them. They could be really long. They could be the name of an\nexisting module in node core.\n\nIf you give this function a package name that **used to be valid**, you'll see\na change in the value of `validForNewPackages` property, and a warnings array\nwill be present:\n\n```js\nvalidate(\"cRaZY-paCkAgE-with-mixed-case-and-more-than-214-characters-----------------------------------------------------------------------------------------------------------------------------------------------------------\")\n```\n\nreturns:\n\n```js\n{\n validForNewPackages: false,\n validForOldPackages: true,\n warnings: [\n \"name can no longer contain capital letters\",\n \"name can no longer contain more than 214 characters\"\n ]\n}\n```\n\n## Tests\n\n```sh\nnpm install\nnpm test\n```\n\n## License\n\nISC\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/validate-npm-package-name.git" + }, + "scripts": { + "test": "tap test/*.js" + }, + "version": "2.2.2" +} diff --git a/node_modules/init-package-json/node_modules/validate-npm-package-name/test/index.js b/node_modules/init-package-json/node_modules/validate-npm-package-name/test/index.js new file mode 100644 index 000000000..1a7dca5de --- /dev/null +++ b/node_modules/init-package-json/node_modules/validate-npm-package-name/test/index.js @@ -0,0 +1,102 @@ +var validate = require("..") +var test = require("tap").test +var path = require("path") +var fs = require("fs") + +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}) + + // Scoped (npm 2+) + + t.deepEqual(validate("@npm/thingy"), {validForNewPackages: true, validForOldPackages: true}) + t.deepEqual(validate("@npm-zors/money!time.js"), {validForNewPackages: true, validForOldPackages: true}) + + // Invalid + + t.deepEqual(validate(""), { + validForNewPackages: false, + validForOldPackages: false, + errors: ["name length must be greater than zero"]}) + + t.deepEqual(validate(""), { + validForNewPackages: false, + validForOldPackages: false, + errors: ["name length must be greater than zero"]}) + + t.deepEqual(validate(".start-with-period"), { + validForNewPackages: false, + validForOldPackages: false, + errors: ["name cannot start with a period"]}) + + t.deepEqual(validate("_start-with-underscore"), { + validForNewPackages: false, + validForOldPackages: false, + errors: ["name cannot start with an underscore"]}) + + t.deepEqual(validate("contain:colons"), { + validForNewPackages: false, + validForOldPackages: false, + errors: ["name can only contain URL-friendly characters"]}) + + t.deepEqual(validate(" leading-space"), { + validForNewPackages: false, + validForOldPackages: false, + errors: ["name cannot contain leading or trailing spaces", "name can only contain URL-friendly characters"]}) + + t.deepEqual(validate("trailing-space "), { + validForNewPackages: false, + validForOldPackages: false, + 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"), { + validForNewPackages: false, + validForOldPackages: false, + errors: ["name can only contain URL-friendly characters"]}) + + t.deepEqual(validate("node_modules"), { + validForNewPackages: false, + validForOldPackages: false, + errors: ["node_modules is a blacklisted name"]}) + + t.deepEqual(validate("favicon.ico"), { + validForNewPackages: false, + validForOldPackages: false, + errors: ["favicon.ico is a blacklisted name"]}) + + // Node/IO Core + + t.deepEqual(validate("http"), { + validForNewPackages: false, + validForOldPackages: true, + warnings: ["http is a core module name"]}) + + // Long Package Names + + t.deepEqual(validate("ifyouwanttogetthesumoftwonumberswherethosetwonumbersarechosenbyfindingthelargestoftwooutofthreenumbersandsquaringthemwhichismultiplyingthembyitselfthenyoushouldinputthreenumbersintothisfunctionanditwilldothatforyou-"), { + validForNewPackages: false, + validForOldPackages: true, + warnings: ["name can no longer contain more than 214 characters"] + }) + + t.deepEqual(validate("ifyouwanttogetthesumoftwonumberswherethosetwonumbersarechosenbyfindingthelargestoftwooutofthreenumbersandsquaringthemwhichismultiplyingthembyitselfthenyoushouldinputthreenumbersintothisfunctionanditwilldothatforyou"), { + validForNewPackages: true, + validForOldPackages: true + }) + + // Legacy Mixed-Case + + t.deepEqual(validate("CAPITAL-LETTERS"), { + validForNewPackages: false, + validForOldPackages: true, + warnings: ["name can no longer contain capital letters"]}) + + t.end() +}) |