first commit
This commit is contained in:
19
build/node_modules/dom-urls/LICENSE
generated
vendored
Normal file
19
build/node_modules/dom-urls/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (C) 2014 Pascal Hartig
|
||||
|
||||
|
||||
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.
|
||||
45
build/node_modules/dom-urls/README.md
generated
vendored
Normal file
45
build/node_modules/dom-urls/README.md
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
Node DOM URLs
|
||||
=============
|
||||
|
||||
[](https://travis-ci.org/passy/node-dom-urls)
|
||||
[](https://codeclimate.com/github/passy/node-dom-urls)
|
||||
[](https://github.com/igrigorik/ga-beacon)
|
||||
|
||||
A partial implementation of the [W3C URL Spec Draft](https://dvcs.w3.org/hg/url/raw-file/tip/Overview.html) for Node building on top of [URIjs](http://medialize.github.io/URI.js/).
|
||||
|
||||
If you find incompatibilities, please [report them](https://github.com/passy/node-dom-urls/issues). Error handling is currently very different from the spec.
|
||||
|
||||
Browser Polyfills
|
||||
-----------------
|
||||
|
||||
- [Joshua Bell's Polyfill](https://github.com/inexorabletash/polyfill/blob/master/url.js)
|
||||
- [Eric Arvidsson's Polyfill](https://github.com/arv/DOM-URL-Polyfill)
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
`npm install dom-urls`
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
```js
|
||||
|
||||
var URL = require('dom-urls');
|
||||
|
||||
var url = new URL('relative', 'http://example.com/sub/');
|
||||
|
||||
url.protocol; // 'http:'
|
||||
url.hostname; // 'example.com'
|
||||
url.pathname; // '/sub/relative/'
|
||||
|
||||
url.host = 'example.net:8080';
|
||||
url.port; // '8080'
|
||||
```
|
||||
|
||||
Why `urijs` instead of `url`?
|
||||
-----------------------------
|
||||
|
||||
I tried it first, but Node's own URL module doesn't propagate changes, so
|
||||
changing the `host` doesn't affect the port and vice-versa and I didn't want to
|
||||
reimplement all of that myself.
|
||||
105
build/node_modules/dom-urls/index.js
generated
vendored
Normal file
105
build/node_modules/dom-urls/index.js
generated
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
'use strict';
|
||||
|
||||
var URI = require('urijs');
|
||||
|
||||
function URL(urlStr, base) {
|
||||
if (!urlStr) {
|
||||
throw new TypeError('You need to provide a URL');
|
||||
}
|
||||
|
||||
this._url = URI(urlStr, base).normalize();
|
||||
|
||||
if (!this._url.protocol()) {
|
||||
throw new SyntaxError('Failed to construct \'URL\': Invalid URL');
|
||||
}
|
||||
}
|
||||
|
||||
URL.prototype = {
|
||||
toString: function () {
|
||||
return this.href;
|
||||
},
|
||||
|
||||
get protocol() {
|
||||
// Spec wants the trailing colon. (See 5.2)
|
||||
return this._url.protocol() + ':';
|
||||
},
|
||||
|
||||
set protocol(value) {
|
||||
// Strip the colon, including anything following it and replace it with a
|
||||
// single one.
|
||||
this._url.protocol(value.replace(/(\:.*)?$/, ':'));
|
||||
},
|
||||
|
||||
get host() {
|
||||
return this._url.clone().normalizeHostname().host();
|
||||
},
|
||||
|
||||
set host(value) {
|
||||
var partial = new URI('proto://' + value);
|
||||
var oldPort = this._url.port();
|
||||
|
||||
// For some reason, we have to keep the port even though we override the
|
||||
// complete host (not just the hostname) to not have one according to the
|
||||
// spec.
|
||||
this._url.host(value);
|
||||
|
||||
if (!partial.port()) {
|
||||
this._url.port(oldPort);
|
||||
}
|
||||
},
|
||||
|
||||
get pathname() {
|
||||
return this._url.pathname();
|
||||
},
|
||||
|
||||
set pathname(value) {
|
||||
this._url.pathname(value);
|
||||
this._url.normalizePathname();
|
||||
},
|
||||
|
||||
get path() {
|
||||
return this._url.path();
|
||||
},
|
||||
|
||||
set path(value) {
|
||||
this._url.path(value);
|
||||
this._url.normalizePath();
|
||||
},
|
||||
|
||||
// Origin is a read-only attribute:
|
||||
// http://url.spec.whatwg.org/#api
|
||||
get origin() {
|
||||
// "Let uri-scheme be the scheme component of the URI,
|
||||
// converted to lowercase."
|
||||
var scheme = this._url.protocol().toLowerCase();
|
||||
|
||||
var hostname = this._url.hostname().toLowerCase();
|
||||
|
||||
var port = '';
|
||||
if (this._url._parts.port !== null &&
|
||||
this._url._parts.port !== URI.defaultPorts[this._url.protocol()]) {
|
||||
port = ':' + this._url.port();
|
||||
}
|
||||
|
||||
return scheme + '://' + hostname + port;
|
||||
}
|
||||
};
|
||||
|
||||
[
|
||||
'href',
|
||||
'hostname',
|
||||
'port',
|
||||
'search',
|
||||
'hash'
|
||||
].forEach(function (property) {
|
||||
Object.defineProperty(URL.prototype, property, {
|
||||
get: function () {
|
||||
return this._url.clone().normalize()[property]();
|
||||
},
|
||||
set: function (value) {
|
||||
this._url[property](value);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = URL;
|
||||
66
build/node_modules/dom-urls/package.json
generated
vendored
Normal file
66
build/node_modules/dom-urls/package.json
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"_from": "dom-urls@^1.1.0",
|
||||
"_id": "dom-urls@1.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-AB3fgWKM0ecGElxxdvU8zsVdkY4=",
|
||||
"_location": "/dom-urls",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "dom-urls@^1.1.0",
|
||||
"name": "dom-urls",
|
||||
"escapedName": "dom-urls",
|
||||
"rawSpec": "^1.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/sw-precache"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/dom-urls/-/dom-urls-1.1.0.tgz",
|
||||
"_shasum": "001ddf81628cd1e706125c7176f53ccec55d918e",
|
||||
"_spec": "dom-urls@^1.1.0",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build/node_modules/sw-precache",
|
||||
"author": {
|
||||
"name": "Pascal Hartig",
|
||||
"email": "passy@twitter.com",
|
||||
"url": "http://passy.me/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/passy/node-dom-urls/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"urijs": "^1.16.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "DOM URLs for Node",
|
||||
"devDependencies": {
|
||||
"chai": "^3.3.0",
|
||||
"mocha": "^2.3.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/passy/node-dom-urls#readme",
|
||||
"keywords": [
|
||||
"dom",
|
||||
"url",
|
||||
"urls"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "dom-urls",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/passy/node-dom-urls.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha -u tdd"
|
||||
},
|
||||
"version": "1.1.0"
|
||||
}
|
||||
Reference in New Issue
Block a user