first commit
This commit is contained in:
21
node_modules/url-join/LICENSE
generated
vendored
Normal file
21
node_modules/url-join/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2015 José F. Romaniello
|
||||
|
||||
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.
|
||||
29
node_modules/url-join/README.md
generated
vendored
Normal file
29
node_modules/url-join/README.md
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
Join all arguments together and normalize the resulting URL.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install url-join
|
||||
```
|
||||
|
||||
If you want to use it directly in a browser use a CDN like [Skypack](https://www.skypack.dev/view/url-join).
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
import urlJoin from 'url-join';
|
||||
|
||||
const fullUrl = urlJoin('http://www.google.com', 'a', '/b/cd', '?foo=123');
|
||||
|
||||
console.log(fullUrl);
|
||||
```
|
||||
|
||||
Prints:
|
||||
|
||||
```
|
||||
'http://www.google.com/a/b/cd?foo=123'
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
9
node_modules/url-join/lib/url-join.d.ts
generated
vendored
Normal file
9
node_modules/url-join/lib/url-join.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Join all arguments together and normalize the resulting url.
|
||||
* This works similar to `path.join` but you shouldn't use `path.join` for urls since it works
|
||||
* differently depending on the operating system and also doesn't work for some cases.
|
||||
*/
|
||||
declare function urlJoin(...parts: string[]): string;
|
||||
declare function urlJoin(parts: string[]): string;
|
||||
|
||||
export default urlJoin;
|
||||
70
node_modules/url-join/lib/url-join.js
generated
vendored
Normal file
70
node_modules/url-join/lib/url-join.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
function normalize (strArray) {
|
||||
var resultArray = [];
|
||||
if (strArray.length === 0) { return ''; }
|
||||
|
||||
if (typeof strArray[0] !== 'string') {
|
||||
throw new TypeError('Url must be a string. Received ' + strArray[0]);
|
||||
}
|
||||
|
||||
// If the first part is a plain protocol, we combine it with the next part.
|
||||
if (strArray[0].match(/^[^/:]+:\/*$/) && strArray.length > 1) {
|
||||
var first = strArray.shift();
|
||||
strArray[0] = first + strArray[0];
|
||||
}
|
||||
|
||||
// There must be two or three slashes in the file protocol, two slashes in anything else.
|
||||
if (strArray[0].match(/^file:\/\/\//)) {
|
||||
strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, '$1:///');
|
||||
} else {
|
||||
strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, '$1://');
|
||||
}
|
||||
|
||||
for (var i = 0; i < strArray.length; i++) {
|
||||
var component = strArray[i];
|
||||
|
||||
if (typeof component !== 'string') {
|
||||
throw new TypeError('Url must be a string. Received ' + component);
|
||||
}
|
||||
|
||||
if (component === '') { continue; }
|
||||
|
||||
if (i > 0) {
|
||||
// Removing the starting slashes for each component but the first.
|
||||
component = component.replace(/^[\/]+/, '');
|
||||
}
|
||||
if (i < strArray.length - 1) {
|
||||
// Removing the ending slashes for each component but the last.
|
||||
component = component.replace(/[\/]+$/, '');
|
||||
} else {
|
||||
// For the last component we will combine multiple slashes to a single one.
|
||||
component = component.replace(/[\/]+$/, '/');
|
||||
}
|
||||
|
||||
resultArray.push(component);
|
||||
|
||||
}
|
||||
|
||||
var str = resultArray.join('/');
|
||||
// Each input component is now separated by a single slash except the possible first plain protocol part.
|
||||
|
||||
// remove trailing slash before parameters or hash
|
||||
str = str.replace(/\/(\?|&|#[^!])/g, '$1');
|
||||
|
||||
// replace ? in parameters with &
|
||||
var parts = str.split('?');
|
||||
str = parts.shift() + (parts.length > 0 ? '?': '') + parts.join('&');
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
export default function urlJoin() {
|
||||
var input;
|
||||
|
||||
if (typeof arguments[0] === 'object') {
|
||||
input = arguments[0];
|
||||
} else {
|
||||
input = [].slice.call(arguments);
|
||||
}
|
||||
|
||||
return normalize(input);
|
||||
}
|
||||
34
node_modules/url-join/package.json
generated
vendored
Normal file
34
node_modules/url-join/package.json
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "url-join",
|
||||
"version": "5.0.0",
|
||||
"description": "Join urls and normalize as in path.join.",
|
||||
"type": "module",
|
||||
"main": "./lib/url-join.js",
|
||||
"exports": "./lib/url-join.js",
|
||||
"types": "./lib/url-join.d.ts",
|
||||
"sideEffects": false,
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --require should"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/jfromaniello/url-join.git"
|
||||
},
|
||||
"keywords": [
|
||||
"url",
|
||||
"join"
|
||||
],
|
||||
"author": "José F. Romaniello <jfromaniello@gmail.com> (http://joseoncode.com)",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"conventional-changelog": "^3.1.25",
|
||||
"mocha": "^9.2.2",
|
||||
"should": "~13.2.3"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user