You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

37 lines
3.5 KiB

{
"name": "realize-package-specifier",
"version": "1.3.0",
"description": "Like npm-package-arg, but more so, producing full file paths and differentiating local tar and directory sources.",
"main": "index.js",
"scripts": {
"test": "tap test/*.js"
},
"license": "ISC",
"repository": {
"type": "git",
"url": "https://github.com/npm/realize-package-specifier.git"
},
"author": {
"name": "Rebecca Turner",
"email": "me@re-becca.org",
"url": "http://re-becca.org"
},
"homepage": "https://github.com/npm/realize-package-specifier",
"dependencies": {
"dezalgo": "^1.0.1",
"npm-package-arg": "^2.1.3"
},
"devDependencies": {
"require-inject": "^1.1.0",
"tap": "^0.4.12"
},
"gitHead": "d05d49409e28404473a292cf99df05642a24c08f",
"readme": "realize-package-specifier\n-------------------------\n\nParse a package specifier, peeking at the disk to differentiate between\nlocal tarballs, directories and named modules. This implements the logic\nused by `npm install` and `npm cache` to determine where to get packages\nfrom.\n\n```javascript\nvar realizePackageSpecifier = require(\"realize-package-specifier\")\nrealizePackageSpecifier(\"foo.tar.gz\", \".\", function (err, package) {\n …\n})\n```\n\n* realizePackageSpecifier(*spec*, [*where*,] *callback*)\n\nParses *spec* using `npm-package-arg` and then uses stat to check to see if\nit refers to a local tarball or package directory. Stats are done relative\nto *where*. If it does then the local module is loaded. If it doesn't then\ntarget is left as a remote package specifier. Package directories are\nrecognized by the presence of a package.json in them.\n\n*spec* -- a package specifier, like: `foo@1.2`, or `foo@user/foo`, or\n`http://x.com/foo.tgz`, or `git+https://github.com/user/foo`\n\n*where* (optional, default: .) -- The directory in which we should look for\nlocal tarballs or package directories.\n\n*callback* function(*err*, *result*) -- Called once we've determined what\nkind of specifier this is. The *result* object will be very like the one\nreturned by `npm-package-arg` except with three differences: 1) There's a\nnew type of `directory`. 2) The `local` type only refers to tarballs. 2)\nFor all `local` and `directory` type results spec will contain the full path of\nthe local package.\n\n## Result Objects\n\nThe full definition of the result object is:\n\n* `name` - If known, the `name` field expected in the resulting pkg.\n* `type` - One of the following strings:\n * `git` - A git repo\n * `github` - A github shorthand, like `user/project`\n * `tag` - A tagged version, like `\"foo@latest\"`\n * `version` - A specific version number, like `\"foo@1.2.3\"`\n * `range` - A version range, like `\"foo@2.x\"`\n * `local` - A local file path\n * `directory` - A local package directory\n * `remote` - An http url (presumably to a tgz)\n* `spec` - The \"thing\". URL, the range, git repo, etc.\n* `raw` - The original un-modified string that was provided.\n* `rawSpec` - The part after the `name@...`, as it was originally\n provided.\n* `scope` - If a name is something like `@org/module` then the `scope`\n field will be set to `org`. If it doesn't have a scoped name, then\n scope is `null`.\n\n",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/npm/realize-package-specifier/issues"
},
"_id": "realize-package-specifier@1.3.0",
"_shasum": "23374a84e6a9188483f346cc939eb58eec85efa5",
"_from": "realize-package-specifier@~1.3.0"
}