aboutsummaryrefslogtreecommitdiff
path: root/node_modules/resolve-url
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/resolve-url')
-rw-r--r--node_modules/resolve-url/.jshintrc44
-rw-r--r--node_modules/resolve-url/LICENSE21
-rw-r--r--node_modules/resolve-url/bower.json15
-rw-r--r--node_modules/resolve-url/changelog.md15
-rw-r--r--node_modules/resolve-url/component.json15
-rw-r--r--node_modules/resolve-url/package.json72
-rw-r--r--node_modules/resolve-url/readme.md83
-rw-r--r--node_modules/resolve-url/resolve-url.js47
-rw-r--r--node_modules/resolve-url/test/resolve-url.js70
9 files changed, 382 insertions, 0 deletions
diff --git a/node_modules/resolve-url/.jshintrc b/node_modules/resolve-url/.jshintrc
new file mode 100644
index 0000000..aaf3358
--- /dev/null
+++ b/node_modules/resolve-url/.jshintrc
@@ -0,0 +1,44 @@
+{
+ "bitwise": true,
+ "camelcase": true,
+ "curly": false,
+ "eqeqeq": true,
+ "es3": true,
+ "forin": true,
+ "immed": false,
+ "indent": false,
+ "latedef": "nofunc",
+ "newcap": false,
+ "noarg": true,
+ "noempty": true,
+ "nonew": false,
+ "plusplus": false,
+ "quotmark": false,
+ "undef": true,
+ "unused": "vars",
+ "strict": false,
+ "trailing": true,
+ "maxparams": 5,
+ "maxdepth": false,
+ "maxstatements": false,
+ "maxcomplexity": false,
+ "maxlen": 100,
+
+ "asi": true,
+ "expr": true,
+ "globalstrict": true,
+ "smarttabs": true,
+ "sub": true,
+
+ "node": true,
+ "browser": true,
+ "globals": {
+ "describe": false,
+ "it": false,
+ "before": false,
+ "beforeEach": false,
+ "after": false,
+ "afterEach": false,
+ "define": false
+ }
+}
diff --git a/node_modules/resolve-url/LICENSE b/node_modules/resolve-url/LICENSE
new file mode 100644
index 0000000..0595be3
--- /dev/null
+++ b/node_modules/resolve-url/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2013 Simon Lydell
+
+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/resolve-url/bower.json b/node_modules/resolve-url/bower.json
new file mode 100644
index 0000000..31aa6f4
--- /dev/null
+++ b/node_modules/resolve-url/bower.json
@@ -0,0 +1,15 @@
+{
+ "name": "resolve-url",
+ "version": "0.2.1",
+ "description": "Like Node.js’ `path.resolve`/`url.resolve` for the browser.",
+ "authors": ["Simon Lydell"],
+ "license": "MIT",
+ "main": "resolve-url.js",
+ "keywords": [
+ "resolve",
+ "url"
+ ],
+ "ignore": [
+ ".*"
+ ]
+}
diff --git a/node_modules/resolve-url/changelog.md b/node_modules/resolve-url/changelog.md
new file mode 100644
index 0000000..2a4a630
--- /dev/null
+++ b/node_modules/resolve-url/changelog.md
@@ -0,0 +1,15 @@
+### Version 0.2.1 (2014-02-25) ###
+
+- Fix edge case when (accidentally) supplying only one argument, and that
+ argument happens to be a falsy value such as `undefined` or `null`.
+
+
+### Version 0.2.0 (2014-02-24) ###
+
+- Disallow passing 0 arguments. It’s weird and inconsistent between browsers.
+ (Backwards incompatible change.)
+
+
+### Version 0.1.0 (2014-02-23) ###
+
+- Initial release.
diff --git a/node_modules/resolve-url/component.json b/node_modules/resolve-url/component.json
new file mode 100644
index 0000000..f37cf00
--- /dev/null
+++ b/node_modules/resolve-url/component.json
@@ -0,0 +1,15 @@
+{
+ "name": "resolve-url",
+ "version": "0.2.1",
+ "license": "MIT",
+ "description": "Like Node.js’ `path.resolve`/`url.resolve` for the browser.",
+ "main": "resolve-url.js",
+ "repo": "lydell/resolve-url",
+ "keywords": [
+ "resolve",
+ "url"
+ ],
+ "scripts": [
+ "resolve-url.js"
+ ]
+}
diff --git a/node_modules/resolve-url/package.json b/node_modules/resolve-url/package.json
new file mode 100644
index 0000000..97b1185
--- /dev/null
+++ b/node_modules/resolve-url/package.json
@@ -0,0 +1,72 @@
+{
+ "_args": [
+ [
+ "resolve-url@0.2.1",
+ "/home/dstaesse/git/website"
+ ]
+ ],
+ "_development": true,
+ "_from": "resolve-url@0.2.1",
+ "_id": "resolve-url@0.2.1",
+ "_inBundle": false,
+ "_integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=",
+ "_location": "/resolve-url",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "version",
+ "registry": true,
+ "raw": "resolve-url@0.2.1",
+ "name": "resolve-url",
+ "escapedName": "resolve-url",
+ "rawSpec": "0.2.1",
+ "saveSpec": null,
+ "fetchSpec": "0.2.1"
+ },
+ "_requiredBy": [
+ "/source-map-resolve"
+ ],
+ "_resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz",
+ "_spec": "0.2.1",
+ "_where": "/home/dstaesse/git/website",
+ "author": {
+ "name": "Simon Lydell"
+ },
+ "bugs": {
+ "url": "https://github.com/lydell/resolve-url/issues"
+ },
+ "description": "Like Node.js’ `path.resolve`/`url.resolve` for the browser.",
+ "devDependencies": {
+ "jshint": "~2.4.3",
+ "tape": "~2.5.0",
+ "testling": "~1.6.0"
+ },
+ "homepage": "https://github.com/lydell/resolve-url#readme",
+ "keywords": [
+ "resolve",
+ "url"
+ ],
+ "license": "MIT",
+ "main": "resolve-url.js",
+ "name": "resolve-url",
+ "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"
+}
diff --git a/node_modules/resolve-url/readme.md b/node_modules/resolve-url/readme.md
new file mode 100644
index 0000000..edfff73
--- /dev/null
+++ b/node_modules/resolve-url/readme.md
@@ -0,0 +1,83 @@
+Overview
+========
+
+[![browser support](https://ci.testling.com/lydell/resolve-url.png)](https://ci.testling.com/lydell/resolve-url)
+
+Like Node.js’ [`path.resolve`]/[`url.resolve`] for the browser.
+
+```js
+var resolveUrl = require("resolve-url")
+
+window.location
+// https://example.com/articles/resolving-urls/edit
+
+resolveUrl("remove")
+// https://example.com/articles/resolving-urls/remove
+
+resolveUrl("/static/scripts/app.js")
+// https://example.com/static/scripts/app.js
+
+// Imagine /static/scripts/app.js contains `//# sourceMappingURL=../source-maps/app.js.map`
+resolveUrl("/static/scripts/app.js", "../source-maps/app.js.map")
+// https://example.com/static/source-maps/app.js.map
+
+resolveUrl("/static/scripts/app.js", "../source-maps/app.js.map", "../coffee/app.coffee")
+// https://example.com/static/coffee/app.coffee
+
+resolveUrl("//cdn.example.com/jquery.js")
+// https://cdn.example.com/jquery.js
+
+resolveUrl("http://foo.org/")
+// http://foo.org/
+```
+
+
+Installation
+============
+
+- `npm install resolve-url`
+- `bower install resolve-url`
+- `component install lydell/resolve-url`
+
+Works with CommonJS, AMD and browser globals, through UMD.
+
+
+Usage
+=====
+
+### `resolveUrl(...urls)` ###
+
+Pass one or more urls. Resolves the last one to an absolute url, using the
+previous ones and `window.location`.
+
+It’s like starting out on `window.location`, and then clicking links with the
+urls as `href` attributes in order, from left to right.
+
+Unlike Node.js’ [`path.resolve`], this function always goes through all of the
+arguments, from left to right. `path.resolve` goes from right to left and only
+in the worst case goes through them all. Should that matter.
+
+Actually, the function is _really_ like clicking a lot of links in series: An
+actual `<a>` gets its `href` attribute set for each url! This means that the
+url resolution of the browser is used, which makes this module really
+light-weight.
+
+Also note that this functions deals with urls, not paths, so in that respect it
+has more in common with Node.js’ [`url.resolve`]. But the arguments are more
+like [`path.resolve`].
+
+[`path.resolve`]: http://nodejs.org/api/path.html#path_path_resolve_from_to
+[`url.resolve`]: http://nodejs.org/api/url.html#url_url_resolve_from_to
+
+
+Tests
+=====
+
+Run `npm test`, which lints the code and then gives you a link to open in a
+browser of choice (using `testling`).
+
+
+License
+=======
+
+[The X11 (“MIT”) License](LICENSE).
diff --git a/node_modules/resolve-url/resolve-url.js b/node_modules/resolve-url/resolve-url.js
new file mode 100644
index 0000000..19e8d04
--- /dev/null
+++ b/node_modules/resolve-url/resolve-url.js
@@ -0,0 +1,47 @@
+// Copyright 2014 Simon Lydell
+// X11 (“MIT”) Licensed. (See LICENSE.)
+
+void (function(root, factory) {
+ if (typeof define === "function" && define.amd) {
+ define(factory)
+ } else if (typeof exports === "object") {
+ module.exports = factory()
+ } else {
+ root.resolveUrl = factory()
+ }
+}(this, function() {
+
+ function resolveUrl(/* ...urls */) {
+ var numUrls = arguments.length
+
+ if (numUrls === 0) {
+ throw new Error("resolveUrl requires at least one argument; got none.")
+ }
+
+ var base = document.createElement("base")
+ base.href = arguments[0]
+
+ if (numUrls === 1) {
+ return base.href
+ }
+
+ var head = document.getElementsByTagName("head")[0]
+ head.insertBefore(base, head.firstChild)
+
+ var a = document.createElement("a")
+ var resolved
+
+ for (var index = 1; index < numUrls; index++) {
+ a.href = arguments[index]
+ resolved = a.href
+ base.href = resolved
+ }
+
+ head.removeChild(base)
+
+ return resolved
+ }
+
+ return resolveUrl
+
+}));
diff --git a/node_modules/resolve-url/test/resolve-url.js b/node_modules/resolve-url/test/resolve-url.js
new file mode 100644
index 0000000..18532ed
--- /dev/null
+++ b/node_modules/resolve-url/test/resolve-url.js
@@ -0,0 +1,70 @@
+// Copyright 2014 Simon Lydell
+// X11 (“MIT”) Licensed. (See LICENSE.)
+
+var test = require("tape")
+
+var resolveUrl = require("../")
+
+"use strict"
+
+test("resolveUrl", function(t) {
+
+ t.plan(7)
+
+ t.equal(typeof resolveUrl, "function", "is a function")
+
+ t.equal(
+ resolveUrl("https://example.com/"),
+ "https://example.com/"
+ )
+
+ var loc = "https://example.com/articles/resolving-urls/edit"
+
+ t.equal(
+ resolveUrl(loc, "remove"),
+ "https://example.com/articles/resolving-urls/remove"
+ )
+
+ t.equal(
+ resolveUrl(loc, "/static/scripts/app.js"),
+ "https://example.com/static/scripts/app.js"
+ )
+
+ t.equal(
+ resolveUrl(loc, "/static/scripts/app.js", "../source-maps/app.js.map"),
+ "https://example.com/static/source-maps/app.js.map"
+ )
+
+ t.equal(
+ resolveUrl(loc, "/static/scripts/app.js", "../source-maps/app.js.map", "../coffee/app.coffee"),
+ "https://example.com/static/coffee/app.coffee"
+ )
+
+ t.equal(
+ resolveUrl(loc, "//cdn.example.com/jquery.js"),
+ "https://cdn.example.com/jquery.js"
+ )
+
+})
+
+test("edge cases", function(t) {
+
+ t.plan(4)
+
+ t["throws"](resolveUrl, /at least one argument/, "throws with no arguments")
+
+ var accidentallyUndefined
+ var result
+ t.doesNotThrow(
+ function() { result = resolveUrl(accidentallyUndefined) },
+ "undefined is still an argument"
+ )
+ t.ok(result.match(/\/undefined$/), "undefined is stringified")
+
+ t.equal(
+ resolveUrl("http://foo.org/test", undefined, {}, ["a/b"], null),
+ "http://foo.org/a/null",
+ "arguments are stringified"
+ )
+
+})