Update Files

This commit is contained in:
2025-01-22 16:18:30 +01:00
parent ed4603cf95
commit a36294b518
16718 changed files with 2960346 additions and 0 deletions

View File

@ -0,0 +1,120 @@
/*
* Copyright (C)2014-2020 Haxe Foundation
*
* 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.
*/
package js.node.url;
/**
Browser-compatible URL class, implemented by following the WHATWG URL Standard.
[Examples of parsed URLs](https://url.spec.whatwg.org/#example-url-parsing) may be found in the Standard itself.
**/
@:jsRequire("url", "URL")
extern class URL {
/**
Creates a new `URL` object by parsing the `input` relative to the `base`.
If `base` is passed as a string, it will be parsed equivalent to `new URL(base)`.
**/
@:overload(function(input:String, ?base:URL):Void {})
function new(input:String, ?base:String):Void;
/**
Gets and sets the fragment portion of the URL.
**/
var hash:String;
/**
Gets and sets the host portion of the URL.
**/
var host:String;
/**
Gets and sets the hostname portion of the URL
The key difference between `url.host` and `url.hostname` is that `url.hostname` does not include the port.
**/
var hostname:String;
/**
Gets and sets the serialized URL.
**/
var href:String;
/**
Gets the read-only serialization of the URL's origin.
**/
var origin(default, null):String;
/**
Gets and sets the password portion of the URL.
**/
var password:String;
/**
Gets and sets the path portion of the URL.
**/
var pathname:String;
/**
Gets and sets the port portion of the URL.
The port value may be a number or a string containing a number in the range `0` to `65535` (inclusive).
Setting the value to the default port of the `URL` objects given `protocol` will result in the port value becoming the empty string (`''`).
**/
var port:String;
/**
Gets and sets the protocol portion of the URL.
**/
var protocol:String;
/**
Gets and sets the serialized query portion of the URL.
**/
var search:String;
/**
Gets the `URLSearchParams` object representing the query parameters of the URL.
This property is read-only; to replace the entirety of query parameters of the URL, use the `url.search` setter.
See [URLSearchParams](https://nodejs.org/api/url.html#url_class_urlsearchparams) documentation for details.
**/
var searchParams(default, null):URLSearchParams;
/**
Gets and sets the username portion of the URL.
**/
var username:String;
/**
The `toString()` method on the `URL` object returns the serialized URL.
The value returned is equivalent to that of `url.href` and `url.toJSON()`.
Because of the need for standard compliance, this method does not allow users to customize the serialization process of the URL.
For more flexibility, `require('url').format()` method might be of interest.
**/
function toString():String;
/**
The `toJSON()` method on the `URL` object returns the serialized URL.
The value returned is equivalent to that of `url.href` and `url.toString()`.
This method is automatically called when an `URL` object is serialized with `JSON.stringify()`.
**/
function toJSON():String;
}

View File

@ -0,0 +1,139 @@
/*
* Copyright (C)2014-2020 Haxe Foundation
*
* 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.
*/
package js.node.url;
import js.node.Iterator;
/**
The `URLSearchParams` API provides read and write access to the query of a `URL`.
The `URLSearchParams` class can also be used standalone with one of the four following constructors.
The `URLSearchParams` class is also available on the global object.
The WHATWG `URLSearchParams` interface and the `querystring` module have similar purpose,
but the purpose of the querystring module is more general, as it allows the customization of delimiter characters (`&` and` `=`). On the other hand, this API is designed purely for URL query strings.
**/
@:jsRequire("url", "URLSearchParams")
extern class URLSearchParams {
@:overload(function(init:String):Void {})
@:overload(function(obj:Dynamic<String>):Void {})
@:overload(function(array:Array<URLSearchParamsEntry>):Void {})
@:overload(function(iter:Iterator<URLSearchParamsEntry>):Void {})
function new():Void;
/**
Append a new name-value pair to the query string.
**/
function append(name:String, value:String):Void;
/**
Remove all name-value pairs whose name is `name`.
**/
function delete(name:String):Void;
/**
Returns an ES6 `Iterator` over each of the name-value pairs in the query.
Each item of the iterator is a JavaScript `Array`.
The first item of the `Array` is the `name`, the second item of the `Array` is the `value`.
**/
function entries():Iterator<URLSearchParamsEntry>;
/**
Iterates over each name-value pair in the query and invokes the given function.
**/
#if haxe4
@:overload(function(fn:(value:String) -> Void, ?thisArg:Dynamic):Void {})
@:overload(function(fn:(value:String, name:String) -> Void, ?thisArg:Dynamic):Void {})
function forEach(fn:(value:String, name:String, searchParams:URLSearchParams) -> Void, ?thisArg:Dynamic):Void;
#else
@:overload(function(fn:String->Void, ?thisArg:Dynamic):Void {})
@:overload(function(fn:String->String->Void, ?thisArg:Dynamic):Void {})
function forEach(fn:String->String->URLSearchParams->Void, ?thisArg:Dynamic):Void;
#end
/**
Returns the value of the first name-value pair whose name is `name`.
If there are no such pairs, `null` is returned.
**/
function get(name:String):String;
/**
Returns the values of all name-value pairs whose name is `name`.
If there are no such pairs, an empty array is returned.
**/
function getAll(name:String):Array<String>;
/**
Returns `true` if there is at least one name-value pair whose name is `name`.
**/
function has(name:String):Bool;
/**
Returns an ES6 `Iterator` over the names of each name-value pair.
**/
function keys():Iterator<String>;
/**
Sets the value in the `URLSearchParams` object associated with `name` to `value`.
If there are any pre-existing name-value pairs whose names are `name`, set the first such pair's value to `value` and remove all others.
If not, append the name-value pair to the query string.
**/
function set(name:String, value:String):Void;
/**
Sort all existing name-value pairs in-place by their names. Sorting is done with a [stable sorting algorithm](https://en.wikipedia.org/wiki/Sorting_algorithm#Stability),
so relative order between name-value pairs with the same name is preserved.
This method can be used, in particular, to increase cache hits.
**/
function sort():Void;
/**
Returns the search parameters serialized as a string, with characters percent-encoded where necessary.
**/
function toString():String;
/**
Returns an ES6 `Iterator` over the values of each name-value pair.
**/
function values():Iterator<String>;
}
/**
The name-value pair access helper for `js.node.url.URLSearchParams.entries()`.
**/
abstract URLSearchParamsEntry(Array<String>) {
public var name(get, never):String;
public var value(get, never):String;
public function new(name:String, value:String) {
this = [name, value];
}
inline function get_name():String {
return this[0];
}
inline function get_value():String {
return this[1];
}
}