UNPKG

@zkochan/pnpm

Version:

Fast, disk space efficient package manager

100 lines (99 loc) 5.13 kB
{ "_args": [ [ { "raw": "resolve-url@^0.2.1", "scope": null, "escapedName": "resolve-url", "name": "resolve-url", "rawSpec": "^0.2.1", "spec": ">=0.2.1 <0.3.0", "type": "range" }, "/home/zkochan/src/pnpm/packages/pnpm/node_modules/source-map-resolve" ] ], "_from": "resolve-url@>=0.2.1 <0.3.0", "_id": "resolve-url@0.2.1", "_inCache": true, "_location": "/resolve-url", "_npmUser": { "name": "lydell", "email": "simon.lydell@gmail.com" }, "_npmVersion": "1.4.4", "_phantomChildren": {}, "_requested": { "raw": "resolve-url@^0.2.1", "scope": null, "escapedName": "resolve-url", "name": "resolve-url", "rawSpec": "^0.2.1", "spec": ">=0.2.1 <0.3.0", "type": "range" }, "_requiredBy": [ "/source-map-resolve" ], "_resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", "_shasum": "2c637fe77c893afd2a663fe21aa9080068e2052a", "_shrinkwrap": null, "_spec": "resolve-url@^0.2.1", "_where": "/home/zkochan/src/pnpm/packages/pnpm/node_modules/source-map-resolve", "author": { "name": "Simon Lydell" }, "bugs": { "url": "https://github.com/lydell/resolve-url/issues" }, "dependencies": {}, "description": "Like Node.js’ `path.resolve`/`url.resolve` for the browser.", "devDependencies": { "jshint": "~2.4.3", "tape": "~2.5.0", "testling": "~1.6.0" }, "directories": {}, "dist": { "shasum": "2c637fe77c893afd2a663fe21aa9080068e2052a", "tarball": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz" }, "homepage": "https://github.com/lydell/resolve-url#readme", "keywords": [ "resolve", "url" ], "license": "MIT", "main": "resolve-url.js", "maintainers": [ { "name": "lydell", "email": "simon.lydell@gmail.com" } ], "name": "resolve-url", "optionalDependencies": {}, "readme": "Overview\r\n========\r\n\r\n[![browser support](https://ci.testling.com/lydell/resolve-url.png)](https://ci.testling.com/lydell/resolve-url)\r\n\r\nLike Node.js’ [`path.resolve`]/[`url.resolve`] for the browser.\r\n\r\n```js\r\nvar resolveUrl = require(\"resolve-url\")\r\n\r\nwindow.location\r\n// https://example.com/articles/resolving-urls/edit\r\n\r\nresolveUrl(\"remove\")\r\n// https://example.com/articles/resolving-urls/remove\r\n\r\nresolveUrl(\"/static/scripts/app.js\")\r\n// https://example.com/static/scripts/app.js\r\n\r\n// Imagine /static/scripts/app.js contains `//# sourceMappingURL=../source-maps/app.js.map`\r\nresolveUrl(\"/static/scripts/app.js\", \"../source-maps/app.js.map\")\r\n// https://example.com/static/source-maps/app.js.map\r\n\r\nresolveUrl(\"/static/scripts/app.js\", \"../source-maps/app.js.map\", \"../coffee/app.coffee\")\r\n// https://example.com/static/coffee/app.coffee\r\n\r\nresolveUrl(\"//cdn.example.com/jquery.js\")\r\n// https://cdn.example.com/jquery.js\r\n\r\nresolveUrl(\"http://foo.org/\")\r\n// http://foo.org/\r\n```\r\n\r\n\r\nInstallation\r\n============\r\n\r\n- `npm install resolve-url`\r\n- `bower install resolve-url`\r\n- `component install lydell/resolve-url`\r\n\r\nWorks with CommonJS, AMD and browser globals, through UMD.\r\n\r\n\r\nUsage\r\n=====\r\n\r\n### `resolveUrl(...urls)` ###\r\n\r\nPass one or more urls. Resolves the last one to an absolute url, using the\r\nprevious ones and `window.location`.\r\n\r\nIt’s like starting out on `window.location`, and then clicking links with the\r\nurls as `href` attributes in order, from left to right.\r\n\r\nUnlike Node.js’ [`path.resolve`], this function always goes through all of the\r\narguments, from left to right. `path.resolve` goes from right to left and only\r\nin the worst case goes through them all. Should that matter.\r\n\r\nActually, the function is _really_ like clicking a lot of links in series: An\r\nactual `<a>` gets its `href` attribute set for each url! This means that the\r\nurl resolution of the browser is used, which makes this module really\r\nlight-weight.\r\n\r\nAlso note that this functions deals with urls, not paths, so in that respect it\r\nhas more in common with Node.js’ [`url.resolve`]. But the arguments are more\r\nlike [`path.resolve`].\r\n\r\n[`path.resolve`]: http://nodejs.org/api/path.html#path_path_resolve_from_to\r\n[`url.resolve`]: http://nodejs.org/api/url.html#url_url_resolve_from_to\r\n\r\n\r\nTests\r\n=====\r\n\r\nRun `npm test`, which lints the code and then gives you a link to open in a\r\nbrowser of choice (using `testling`).\r\n\r\n\r\nLicense\r\n=======\r\n\r\n[The X11 (“MIT”) License](LICENSE).\r\n", "readmeFilename": "readme.md", "repository": { "type": "git", "url": "git+https://github.com/lydell/resolve-url.git" }, "scripts": { "test": "jshint resolve-url.js test/ && testling -u" }, "testling": { "files": "test/*.js", "browsers": [ "ie/8..latest", "chrome/latest", "firefox/latest", "opera/12", "opera/latest", "safari/5", "iphone/6", "android-browser/4" ] }, "version": "0.2.1" }