nav tabs on admin dashboard
This commit is contained in:
176
node_modules/normalize-url/index.js
generated
vendored
176
node_modules/normalize-url/index.js
generated
vendored
@@ -1,100 +1,92 @@
|
||||
'use strict';
|
||||
var url = require('url');
|
||||
var punycode = require('punycode');
|
||||
var queryString = require('query-string');
|
||||
var prependHttp = require('prepend-http');
|
||||
var sortKeys = require('sort-keys');
|
||||
var objectAssign = require('object-assign');
|
||||
// TODO: Use the `URL` global when targeting Node.js 10
|
||||
const URLParser = typeof URL === 'undefined' ? require('url').URL : URL;
|
||||
|
||||
var DEFAULT_PORTS = {
|
||||
'http:': 80,
|
||||
'https:': 443,
|
||||
'ftp:': 21
|
||||
const testParameter = (name, filters) => {
|
||||
return filters.some(filter => filter instanceof RegExp ? filter.test(name) : filter === name);
|
||||
};
|
||||
|
||||
// protocols that always contain a `//`` bit
|
||||
var slashedProtocol = {
|
||||
'http': true,
|
||||
'https': true,
|
||||
'ftp': true,
|
||||
'gopher': true,
|
||||
'file': true,
|
||||
'http:': true,
|
||||
'https:': true,
|
||||
'ftp:': true,
|
||||
'gopher:': true,
|
||||
'file:': true
|
||||
};
|
||||
|
||||
function testParameter(name, filters) {
|
||||
return filters.some(function (filter) {
|
||||
return filter instanceof RegExp ? filter.test(name) : filter === name;
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = function (str, opts) {
|
||||
opts = objectAssign({
|
||||
module.exports = (urlString, opts) => {
|
||||
opts = Object.assign({
|
||||
defaultProtocol: 'http:',
|
||||
normalizeProtocol: true,
|
||||
normalizeHttps: false,
|
||||
stripFragment: true,
|
||||
forceHttp: false,
|
||||
forceHttps: false,
|
||||
stripHash: true,
|
||||
stripWWW: true,
|
||||
removeQueryParameters: [/^utm_\w+/i],
|
||||
removeTrailingSlash: true,
|
||||
removeDirectoryIndex: false
|
||||
removeDirectoryIndex: false,
|
||||
sortQueryParameters: true
|
||||
}, opts);
|
||||
|
||||
if (typeof str !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
// Backwards compatibility
|
||||
if (Reflect.has(opts, 'normalizeHttps')) {
|
||||
opts.forceHttp = opts.normalizeHttps;
|
||||
}
|
||||
|
||||
var hasRelativeProtocol = str.indexOf('//') === 0;
|
||||
if (Reflect.has(opts, 'normalizeHttp')) {
|
||||
opts.forceHttps = opts.normalizeHttp;
|
||||
}
|
||||
|
||||
// prepend protocol
|
||||
str = prependHttp(str.trim()).replace(/^\/\//, 'http://');
|
||||
if (Reflect.has(opts, 'stripFragment')) {
|
||||
opts.stripHash = opts.stripFragment;
|
||||
}
|
||||
|
||||
var urlObj = url.parse(str);
|
||||
urlString = urlString.trim();
|
||||
|
||||
if (opts.normalizeHttps && urlObj.protocol === 'https:') {
|
||||
const hasRelativeProtocol = urlString.startsWith('//');
|
||||
const isRelativeUrl = !hasRelativeProtocol && /^\.*\//.test(urlString);
|
||||
|
||||
// Prepend protocol
|
||||
if (!isRelativeUrl) {
|
||||
urlString = urlString.replace(/^(?!(?:\w+:)?\/\/)|^\/\//, opts.defaultProtocol);
|
||||
}
|
||||
|
||||
const urlObj = new URLParser(urlString);
|
||||
|
||||
if (opts.forceHttp && opts.forceHttps) {
|
||||
throw new Error('The `forceHttp` and `forceHttps` options cannot be used together');
|
||||
}
|
||||
|
||||
if (opts.forceHttp && urlObj.protocol === 'https:') {
|
||||
urlObj.protocol = 'http:';
|
||||
}
|
||||
|
||||
if (!urlObj.hostname && !urlObj.pathname) {
|
||||
throw new Error('Invalid URL');
|
||||
if (opts.forceHttps && urlObj.protocol === 'http:') {
|
||||
urlObj.protocol = 'https:';
|
||||
}
|
||||
|
||||
// prevent these from being used by `url.format`
|
||||
delete urlObj.host;
|
||||
delete urlObj.query;
|
||||
|
||||
// remove fragment
|
||||
if (opts.stripFragment) {
|
||||
delete urlObj.hash;
|
||||
// Remove hash
|
||||
if (opts.stripHash) {
|
||||
urlObj.hash = '';
|
||||
}
|
||||
|
||||
// remove default port
|
||||
var port = DEFAULT_PORTS[urlObj.protocol];
|
||||
if (Number(urlObj.port) === port) {
|
||||
delete urlObj.port;
|
||||
}
|
||||
|
||||
// remove duplicate slashes
|
||||
// Remove duplicate slashes if not preceded by a protocol
|
||||
if (urlObj.pathname) {
|
||||
urlObj.pathname = urlObj.pathname.replace(/\/{2,}/g, '/');
|
||||
// TODO: Use the following instead when targeting Node.js 10
|
||||
// `urlObj.pathname = urlObj.pathname.replace(/(?<!https?:)\/{2,}/g, '/');`
|
||||
urlObj.pathname = urlObj.pathname.replace(/((?![https?:]).)\/{2,}/g, (_, p1) => {
|
||||
if (/^(?!\/)/g.test(p1)) {
|
||||
return `${p1}/`;
|
||||
}
|
||||
return '/';
|
||||
});
|
||||
}
|
||||
|
||||
// decode URI octets
|
||||
// Decode URI octets
|
||||
if (urlObj.pathname) {
|
||||
urlObj.pathname = decodeURI(urlObj.pathname);
|
||||
}
|
||||
|
||||
// remove directory index
|
||||
// Remove directory index
|
||||
if (opts.removeDirectoryIndex === true) {
|
||||
opts.removeDirectoryIndex = [/^index\.[a-z]+$/];
|
||||
}
|
||||
|
||||
if (Array.isArray(opts.removeDirectoryIndex) && opts.removeDirectoryIndex.length) {
|
||||
var pathComponents = urlObj.pathname.split('/');
|
||||
var lastComponent = pathComponents[pathComponents.length - 1];
|
||||
if (Array.isArray(opts.removeDirectoryIndex) && opts.removeDirectoryIndex.length > 0) {
|
||||
let pathComponents = urlObj.pathname.split('/');
|
||||
const lastComponent = pathComponents[pathComponents.length - 1];
|
||||
|
||||
if (testParameter(lastComponent, opts.removeDirectoryIndex)) {
|
||||
pathComponents = pathComponents.slice(0, pathComponents.length - 1);
|
||||
@@ -102,60 +94,46 @@ module.exports = function (str, opts) {
|
||||
}
|
||||
}
|
||||
|
||||
// resolve relative paths, but only for slashed protocols
|
||||
if (slashedProtocol[urlObj.protocol]) {
|
||||
var domain = urlObj.protocol + '//' + urlObj.hostname;
|
||||
var relative = url.resolve(domain, urlObj.pathname);
|
||||
urlObj.pathname = relative.replace(domain, '');
|
||||
}
|
||||
|
||||
if (urlObj.hostname) {
|
||||
// IDN to Unicode
|
||||
urlObj.hostname = punycode.toUnicode(urlObj.hostname).toLowerCase();
|
||||
|
||||
// remove trailing dot
|
||||
// Remove trailing dot
|
||||
urlObj.hostname = urlObj.hostname.replace(/\.$/, '');
|
||||
|
||||
// remove `www.`
|
||||
if (opts.stripWWW) {
|
||||
// Remove `www.`
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
if (opts.stripWWW && /^www\.([a-z\-\d]{2,63})\.([a-z\.]{2,5})$/.test(urlObj.hostname)) {
|
||||
// Each label should be max 63 at length (min: 2).
|
||||
// The extension should be max 5 at length (min: 2).
|
||||
// Source: https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names
|
||||
urlObj.hostname = urlObj.hostname.replace(/^www\./, '');
|
||||
}
|
||||
}
|
||||
|
||||
// remove URL with empty query string
|
||||
if (urlObj.search === '?') {
|
||||
delete urlObj.search;
|
||||
}
|
||||
|
||||
var queryParameters = queryString.parse(urlObj.search);
|
||||
|
||||
// remove query unwanted parameters
|
||||
// Remove query unwanted parameters
|
||||
if (Array.isArray(opts.removeQueryParameters)) {
|
||||
for (var key in queryParameters) {
|
||||
for (const key of [...urlObj.searchParams.keys()]) {
|
||||
if (testParameter(key, opts.removeQueryParameters)) {
|
||||
delete queryParameters[key];
|
||||
urlObj.searchParams.delete(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sort query parameters
|
||||
urlObj.search = queryString.stringify(sortKeys(queryParameters));
|
||||
// Sort query parameters
|
||||
if (opts.sortQueryParameters) {
|
||||
urlObj.searchParams.sort();
|
||||
}
|
||||
|
||||
// decode query parameters
|
||||
urlObj.search = decodeURIComponent(urlObj.search);
|
||||
// Take advantage of many of the Node `url` normalizations
|
||||
urlString = urlObj.toString();
|
||||
|
||||
// take advantage of many of the Node `url` normalizations
|
||||
str = url.format(urlObj);
|
||||
|
||||
// remove ending `/`
|
||||
// Remove ending `/`
|
||||
if (opts.removeTrailingSlash || urlObj.pathname === '/') {
|
||||
str = str.replace(/\/$/, '');
|
||||
urlString = urlString.replace(/\/$/, '');
|
||||
}
|
||||
|
||||
// restore relative protocol, if applicable
|
||||
// Restore relative protocol, if applicable
|
||||
if (hasRelativeProtocol && !opts.normalizeProtocol) {
|
||||
str = str.replace(/^http:\/\//, '//');
|
||||
urlString = urlString.replace(/^http:\/\//, '//');
|
||||
}
|
||||
|
||||
return str;
|
||||
return urlString;
|
||||
};
|
||||
|
||||
20
node_modules/normalize-url/license
generated
vendored
20
node_modules/normalize-url/license
generated
vendored
@@ -1,21 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
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:
|
||||
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 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.
|
||||
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.
|
||||
|
||||
38
node_modules/normalize-url/package.json
generated
vendored
38
node_modules/normalize-url/package.json
generated
vendored
@@ -1,26 +1,26 @@
|
||||
{
|
||||
"_from": "normalize-url@^1.4.0",
|
||||
"_id": "normalize-url@1.9.1",
|
||||
"_from": "normalize-url@^3.0.0",
|
||||
"_id": "normalize-url@3.3.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-LMDWazHqIwNkWENuNiDYWVTGbDw=",
|
||||
"_integrity": "sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg==",
|
||||
"_location": "/normalize-url",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "normalize-url@^1.4.0",
|
||||
"raw": "normalize-url@^3.0.0",
|
||||
"name": "normalize-url",
|
||||
"escapedName": "normalize-url",
|
||||
"rawSpec": "^1.4.0",
|
||||
"rawSpec": "^3.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.4.0"
|
||||
"fetchSpec": "^3.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/postcss-normalize-url"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-1.9.1.tgz",
|
||||
"_shasum": "2cc0d66b31ea23036458436e3620d85954c66c3c",
|
||||
"_spec": "normalize-url@^1.4.0",
|
||||
"_resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-3.3.0.tgz",
|
||||
"_shasum": "b2e1c4dc4f7c6d57743df733a4f5978d18650559",
|
||||
"_spec": "normalize-url@^3.0.0",
|
||||
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\postcss-normalize-url",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
@@ -31,20 +31,16 @@
|
||||
"url": "https://github.com/sindresorhus/normalize-url/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"object-assign": "^4.0.1",
|
||||
"prepend-http": "^1.0.0",
|
||||
"query-string": "^4.1.0",
|
||||
"sort-keys": "^1.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Normalize a URL",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "^0.16.0"
|
||||
"coveralls": "^3.0.0",
|
||||
"nyc": "^12.0.2",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
"node": ">=6"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
@@ -56,14 +52,10 @@
|
||||
"uri",
|
||||
"address",
|
||||
"string",
|
||||
"str",
|
||||
"normalise",
|
||||
"normalization",
|
||||
"normalisation",
|
||||
"query",
|
||||
"string",
|
||||
"querystring",
|
||||
"unicode",
|
||||
"simplify",
|
||||
"strip",
|
||||
"trim",
|
||||
@@ -76,7 +68,7 @@
|
||||
"url": "git+https://github.com/sindresorhus/normalize-url.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
"test": "xo && nyc ava"
|
||||
},
|
||||
"version": "1.9.1"
|
||||
"version": "3.3.0"
|
||||
}
|
||||
|
||||
64
node_modules/normalize-url/readme.md
generated
vendored
64
node_modules/normalize-url/readme.md
generated
vendored
@@ -1,6 +1,6 @@
|
||||
# normalize-url [](https://travis-ci.org/sindresorhus/normalize-url)
|
||||
# normalize-url [](https://travis-ci.org/sindresorhus/normalize-url) [](https://coveralls.io/github/sindresorhus/normalize-url?branch=master)
|
||||
|
||||
> [Normalize](http://en.wikipedia.org/wiki/URL_normalization) a URL
|
||||
> [Normalize](https://en.wikipedia.org/wiki/URL_normalization) a URL
|
||||
|
||||
Useful when you need to display, store, deduplicate, sort, compare, etc, URLs.
|
||||
|
||||
@@ -8,7 +8,7 @@ Useful when you need to display, store, deduplicate, sort, compare, etc, URLs.
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save normalize-url
|
||||
$ npm install normalize-url
|
||||
```
|
||||
|
||||
|
||||
@@ -37,12 +37,19 @@ URL to normalize.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### defaultProtocol
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `http:`
|
||||
|
||||
##### normalizeProtocol
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Prepend `http:` to the URL if it's protocol-relative.
|
||||
Prepends `defaultProtocol` to the URL if it's protocol-relative.
|
||||
|
||||
```js
|
||||
normalizeUrl('//sindresorhus.com:80/');
|
||||
@@ -52,12 +59,12 @@ normalizeUrl('//sindresorhus.com:80/', {normalizeProtocol: false});
|
||||
//=> '//sindresorhus.com'
|
||||
```
|
||||
|
||||
##### normalizeHttps
|
||||
##### forceHttp
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `false`
|
||||
|
||||
Normalize `https:` URLs to `http:`.
|
||||
Normalizes `https:` URLs to `http:`.
|
||||
|
||||
```js
|
||||
normalizeUrl('https://sindresorhus.com:80/');
|
||||
@@ -67,18 +74,35 @@ normalizeUrl('https://sindresorhus.com:80/', {normalizeHttps: true});
|
||||
//=> 'http://sindresorhus.com'
|
||||
```
|
||||
|
||||
##### stripFragment
|
||||
##### forceHttps
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `false`
|
||||
|
||||
Normalizes `http:` URLs to `https:`.
|
||||
|
||||
```js
|
||||
normalizeUrl('https://sindresorhus.com:80/');
|
||||
//=> 'https://sindresorhus.com'
|
||||
|
||||
normalizeUrl('http://sindresorhus.com:80/', {normalizeHttp: true});
|
||||
//=> 'https://sindresorhus.com'
|
||||
```
|
||||
|
||||
This option can't be used with the `forceHttp` option at the same time.
|
||||
|
||||
##### stripHash
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Remove the fragment at the end of the URL.
|
||||
Removes hash from the URL.
|
||||
|
||||
```js
|
||||
normalizeUrl('sindresorhus.com/about.html#contact');
|
||||
//=> 'http://sindresorhus.com/about.html'
|
||||
|
||||
normalizeUrl('sindresorhus.com/about.html#contact', {stripFragment: false});
|
||||
normalizeUrl('sindresorhus.com/about.html#contact', {stripHash: false});
|
||||
//=> 'http://sindresorhus.com/about.html#contact'
|
||||
```
|
||||
|
||||
@@ -87,7 +111,7 @@ normalizeUrl('sindresorhus.com/about.html#contact', {stripFragment: false});
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Remove `www.` from the URL.
|
||||
Removes `www.` from the URL.
|
||||
|
||||
```js
|
||||
normalizeUrl('http://www.sindresorhus.com/about.html#contact');
|
||||
@@ -102,7 +126,7 @@ normalizeUrl('http://www.sindresorhus.com/about.html#contact', {stripWWW: false}
|
||||
Type: `Array<RegExp|string>`<br>
|
||||
Default: `[/^utm_\w+/i]`
|
||||
|
||||
Remove query parameters that matches any of the provided strings or regexes.
|
||||
Removes query parameters that matches any of the provided strings or regexes.
|
||||
|
||||
```js
|
||||
normalizeUrl('www.sindresorhus.com?foo=bar&ref=test_ref', {
|
||||
@@ -116,7 +140,7 @@ normalizeUrl('www.sindresorhus.com?foo=bar&ref=test_ref', {
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Remove trailing slash.
|
||||
Removes trailing slash.
|
||||
|
||||
**Note:** Trailing slash is always removed if the URL doesn't have a pathname.
|
||||
|
||||
@@ -136,7 +160,7 @@ normalizeUrl('http://sindresorhus.com/', {removeTrailingSlash: false});
|
||||
Type: `boolean` `Array<RegExp|string>`<br>
|
||||
Default: `false`
|
||||
|
||||
Remove the default directory index file from path that matches any of the provided strings or regexes. When `true`, the regex `/^index\.[a-z]+$/` is used.
|
||||
Removes the default directory index file from path that matches any of the provided strings or regexes. When `true`, the regex `/^index\.[a-z]+$/` is used.
|
||||
|
||||
```js
|
||||
normalizeUrl('www.sindresorhus.com/foo/default.php', {
|
||||
@@ -145,6 +169,20 @@ normalizeUrl('www.sindresorhus.com/foo/default.php', {
|
||||
//=> 'http://sindresorhus.com/foo'
|
||||
```
|
||||
|
||||
##### sortQueryParameters
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Sorts the query parameters alphabetically by key.
|
||||
|
||||
```js
|
||||
normalizeUrl('www.sindresorhus.com?b=two&a=one&c=three', {
|
||||
sortQueryParameters: false
|
||||
});
|
||||
//=> 'http://sindresorhus.com/?b=two&a=one&c=three'
|
||||
```
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
|
||||
Reference in New Issue
Block a user